Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uploading files from front-end entry form causes error #4382

Closed
elivz opened this issue Jun 7, 2019 · 4 comments
Closed

Uploading files from front-end entry form causes error #4382

elivz opened this issue Jun 7, 2019 · 4 comments
Assignees

Comments

@elivz
Copy link

elivz commented Jun 7, 2019

Description

It appears that something very similar to #2018 is happening again in 3.2-beta1. When I try to upload an image, from a simple front-end entry form, I get the message "The file “assets5cfa79b4e23145.94933774.jpg” does not appear to be an image."

Steps to reproduce

  1. Create a new template with the following form markup.
  2. Select an image in the file input and try to save the entry.
  3. Get error "The file assetsxxxxxxx.jpg does not appear to be an image", with the stacktrace below.
  4. The file itself does get saved in the correct location in the volume specified in the field settings, but it is not indexed as an Asset or linked to the field. Also, a zero-byte temporary file with the name mentioned in the error message is left in /storage/runtime/temp.

Template

<form accept-charset="UTF-8" enctype="multipart/form-data" method="post" action="">
  {{ csrfInput() }}
  <input name="action" type="hidden" value="entries/save-entry">
  <input name="sectionId" type="hidden" value="1">
  {% if entry is defined %}
    <input type="hidden" name="entryId" value="{{ entry.id }}">
  {% endif %}
  <input type="file" name="fields[memberHeadshot]">
  <button type="submit">Save</button>
</form>

Stacktrace

craft\errors\ImageException: The file “assets5cfa7ced96fa59.41573387.jpg” does not appear to be an image. in /var/www/dist/vendor/craftcms/cms/src/image/Raster.php:168
Stack trace:
#0 /var/www/dist/vendor/craftcms/cms/src/services/Images.php(197): craft\image\Raster->loadImage('/var/www/dist/s...')
#1 /var/www/dist/vendor/craftcms/cms/src/services/Images.php(305): craft\services\Images->loadImage('/var/www/dist/s...')
#2 /var/www/dist/vendor/craftcms/cms/src/helpers/Image.php(172): craft\services\Images->cleanImage('/var/www/dist/s...')
#3 /var/www/dist/vendor/craftcms/cms/src/elements/Asset.php(1288): craft\helpers\Image::cleanImageByPath('/var/www/dist/s...')
#4 /var/www/dist/vendor/craftcms/cms/src/services/Elements.php(623): craft\elements\Asset->afterSave(true)
#5 /var/www/dist/vendor/craftcms/cms/src/fields/Assets.php(446): craft\services\Elements->saveElement(Object(craft\elements\Asset))
#6 /var/www/dist/vendor/craftcms/cms/src/base/Element.php(2022): craft\fields\Assets->afterElementSave(Object(craft\elements\Entry), true)
#7 /var/www/dist/vendor/craftcms/cms/src/elements/Entry.php(1193): craft\base\Element->afterSave(true)
#8 /var/www/dist/vendor/craftcms/cms/src/services/Elements.php(623): craft\elements\Entry->afterSave(true)
#9 /var/www/dist/vendor/craftcms/cms/src/services/Elements.php(899): craft\services\Elements->saveElement(Object(craft\elements\Entry), false, false)
#10 /var/www/dist/vendor/craftcms/cms/src/services/Revisions.php(163): craft\services\Elements->duplicateElement(Object(craft\elements\Entry), Array)
#11 /var/www/dist/vendor/craftcms/cms/src/elements/Entry.php(1203): craft\services\Revisions->createRevision(Object(craft\elements\Entry), '1', NULL)
#12 /var/www/dist/vendor/craftcms/cms/src/services/Elements.php(642): craft\elements\Entry->afterPropagate(false)
#13 /var/www/dist/vendor/craftcms/cms/src/controllers/EntriesController.php(564): craft\services\Elements->saveElement(Object(craft\elements\Entry))
#14 [internal function]: craft\controllers\EntriesController->actionSaveEntry()
#15 /var/www/dist/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#16 /var/www/dist/vendor/yiisoft/yii2/base/Controller.php(157): yii\base\InlineAction->runWithParams(Array)
#17 /var/www/dist/vendor/craftcms/cms/src/web/Controller.php(186): yii\base\Controller->runAction('save-entry', Array)
#18 /var/www/dist/vendor/yiisoft/yii2/base/Module.php(528): craft\web\Controller->runAction('save-entry', Array)
#19 /var/www/dist/vendor/craftcms/cms/src/web/Application.php(298): yii\base\Module->runAction('entries/save-en...', Array)
#20 /var/www/dist/vendor/craftcms/cms/src/web/Application.php(565): craft\web\Application->runAction('entries/save-en...', Array)
#21 /var/www/dist/vendor/craftcms/cms/src/web/Application.php(277): craft\web\Application->_processActionRequest(Object(craft\web\Request))
#22 /var/www/dist/vendor/yiisoft/yii2/base/Application.php(386): craft\web\Application->handleRequest(Object(craft\web\Request))
#23 /var/www/dist/public_html/index.php(22): yii\base\Application->run()
#24 {main}
@elivz
Copy link
Author

elivz commented Jul 10, 2019

Hey, just wondering if anyone has had a chance to look at this yet? Looks like it's still causing fatal errors in the 3.2 final release.

@andris-sevcenko
Copy link
Contributor

Just confirmed that there is an issue with the revision/draft logic and Assets. Looking into this.

@brandonkelly
Copy link
Member

Hey @elivz, we just released Craft 3.2.1 with a fix for this.

@elivz
Copy link
Author

elivz commented Jul 12, 2019

Thanks! I'll try it out in the next couple days and let you know if I have any further problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants