You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For some reason I was unable to upload files on my live server. When trying this, I was given a simple JavaScript alert saying "There was a problem with uploading the file.". After some digging and commenting out code, I discovered that this was because /storage/runtime/temp was not writable.
A possible fix would be to improve \craft\controllers\AssetsController::_getUploadedFileTempPath. Right now throw new UploadFailedException(0); is thrown when \craft\web\UploadedFile::saveAsTempFile throws an exception. Having the exception message of \yii\base\ErrorException shown in the JavaScript alert (or web.log) would have made it less confusing to me.
Steps to reproduce
Make sure /storage/runtime/temp is not writable.
Attempt to upload a file
Additional info
Craft version: 3.0.4
PHP version: 7.0.27
Database driver & version: MySQL 5.7.21
Plugins & versions: -
Note: I am using Docker, which is why file permissions are a bit more complicated.
The text was updated successfully, but these errors were encountered:
We wouldn’t want to expose the original PHP error, because it will likely contain a file path, which is considered sensitive. However I’ve just updated the exception handling so that it will at least log the original error. So if this crops up again, you can search your logs for “An error occurred when saving an asset”, and you fill find the full exception logged right after that (including the original error).
Description
For some reason I was unable to upload files on my live server. When trying this, I was given a simple JavaScript alert saying "There was a problem with uploading the file.". After some digging and commenting out code, I discovered that this was because
/storage/runtime/temp
was not writable.A possible fix would be to improve
\craft\controllers\AssetsController::_getUploadedFileTempPath
. Right nowthrow new UploadFailedException(0);
is thrown when\craft\web\UploadedFile::saveAsTempFile
throws an exception. Having the exception message of\yii\base\ErrorException
shown in the JavaScript alert (orweb.log
) would have made it less confusing to me.Steps to reproduce
/storage/runtime/temp
is not writable.Additional info
Note: I am using Docker, which is why file permissions are a bit more complicated.
The text was updated successfully, but these errors were encountered: