I have searched this forum and used my Google-Fu but I cannot find find for this error: "The file [file.jpg] could not be saved. An unknown error has occurred." Our developer (I'm the designer) is yet to be replaced, and we have a launch scheduled for Tuesday 9/3, so we're in a tough spot. The crucial element is to be able to upload images. All help is GREATLY appreciated.
We have several Drupal installs on this server, all referring to a shared module folder. We're getting this error across all of them.
When I hit Upload I get the error "The file [file.jpg] could not be saved. An unknown error has occurred." followed quickly by "Upload failed." The log is not catching anything, no errors. It's not a file size or type issue (been there), or user permissions (done that), or the particular directory being uploaded to (see: t-shirt). IMCE is up to date, and for giggles I made sure CKEditor was, too. I've confirmed that IMCE's settings are correct.
I'm thinking server permissions or Javascript issues...? Those both came up in my semi-relevant search results, but no one had success with permissions and I'm not sure how/what I need to do for the latter.
Same errors when use an image field on a node:
The file news.jpg could not be saved. An unknown error has occurred.
The file in the Blog Image field was unable to be uploaded.
Comments
Comment #1
ufku CreditAttribution: ufku commentedThis error thrown by includes/file.inc. PHP fails to upload a file but does not report any of the known error codes. You should check your web server logs.
Comment #2
beardedgeek CreditAttribution: beardedgeek commentedI have the same issue. Web server logs are empty.
Comment #2.0
beardedgeek CreditAttribution: beardedgeek commentedAdditional info
Comment #3
bryanzera CreditAttribution: bryanzera commentedI encountered this problem when I was out of space on the file system temporary directory
Check to see where your temporary directory is at admin/config/media/file-system and see if that disk is out of space.
Comment #4
bryanzera CreditAttribution: bryanzera commentedUPDATE: While Drupal uses the temporary directory specified at admin/config/media/file-system, the server still uses whatever directory PHP specifies in the upload_tmp_dir variable in PHP.ini. The advice in the previous comment applies to this directory, too: Make sure that it's not full and that the file that you're uploading doesn't exceed the space available.
Comment #5
Sansui CreditAttribution: Sansui commentedI am also experiencing this issue. On a WHM/CloudLinux server I have several Drupal 7 sites running. It was running PHP 5.2.17 and I upgraded that to 5.4.23 using easyapache. After that update I get the generic error referenced in this thread that leaves no error logs on the server and has very few hits on google.
CloudLinux has the option of changing PHP versions for an account so I also tried 5.2 and 5.3
My tmp directory is fine and writeable, and in fact everything was working fine across these Drupal sites before the easyapache update. Image styles are being generated, modules are saving their thumbnails - it seems Drupal has no issue doing its own things with the existing files but users are unable to upload any files, anywhere.
No errors, no problems reported. Totally baffling.
Comment #6
keven1894 CreditAttribution: keven1894 commentedI have experienced the same issue several times. The solution might be different based on your hosting environment. I am hosting my Drupal site under a window 2008 server + IIS stack. However, I finally figured that the error about "could not be saved. An unknown error has occurred" especially when the log did not catch anything normally caused by permission issues.
The tricks to fix this problem is about set correct user for corresponding directories:
;Temporary directory for HTTP uploaded files (will use system default if not
;specified).
; http://php.net/upload-tmp-dir
; upload_tmp_dir =
If you already try everything and nothing works, just uncommon this line and specify a temp folder path (e.g. c:\files\temp) and grand iis user write permission. This will automatically rewrite your Drupal site temp file folder to this location. It will fix the issue
Comment #7
Ked CreditAttribution: Ked commentedCan confirm keven1894's solution worked for me.
This issue occurred after migratin a Drupal install to a new server with a new PHP config.
Edited php.ini and set upload_tmp_dir = /tmp (on Linux). Works perfectly now.
Comment #8
rutgers03 CreditAttribution: rutgers03 commentedFor linux I added the /var/tmp folder and that worked as well.
Comment #9
lolmanKD CreditAttribution: lolmanKD as a volunteer commentedNormally this issue occurs in old versions of Drupal 7.
The file upload issue are generally related to permission issues or the .htaccess issues.
Deny from all
This will definitely solve your problem.
Thanks!
Comment #10
AswathyAjish CreditAttribution: AswathyAjish commented#9 worked for me. Thanks a lot.
Comment #11
thallesThanks @all!
Comment #12
thallesComment #13
thallesComment #15
prairiedog CreditAttribution: prairiedog commentedIn our case, the client had exceeded their disk quota on the server. We cleared up some room, and things were back to normal instantly. Just FYI in case it helps anyone dealing with this error.
Comment #16
voam CreditAttribution: voam as a volunteer commentedOn a windows 10 developer machine in php.ini I set
upload_tmp_dir ="C:\logs\tmp"
and gave the IUSR account write permission of that directory.
Within the drupal site app I also created the directory sites\default\files\tmp, but I am not sure if that made a difference.
In any event, now the styles are appearing as expected.