Posted by jasonk1230 on July 3, 2009 at 10:44am
I just installed Drupal in a subdomain on my server (example.com/drupal). After enabling only the Upload module (in addition to the other default-on modules), I went to create content and attempted to upload an attachment. That's when the weird behavior starts:
- When I attempt to upload a file that is well within the site's size limit (say, 10 kb?), the site appears to upload the file (the loading bar appears), but then it simply reverts back to the blank Browse box without showing the uploaded file. There is no error message and nothing is uploaded to the tmp directory or the files folder.
Because I got no error message, I tried to see what happened when I was in a situation that I should get one.
- When I attempt to upload a file larger than the site's limit (say, 1 mb), I get an error that reads "Validation error."
- When I attempt to upload a file of a prohibited extension, I have the same problem as with a file of the right extenstion. The site appears to upload the file, then reverts back to the empty Browse box without an error.
I've checked the file directory permissions; they're all correct. I also used Firebug to check the network traffic. The file seems to be sent just fine, but the response that comes back is always the same:
{ "status": true, "data": "\x3cdiv class=\"form-item\" id=\"edit-upload-wrapper\"\x3e\n \x3clabel for
=\"edit-upload\"\x3eAttach new file: \x3c/label\x3e\n \x3cinput type=\"file\" name=\"files[upload]\"
class=\"form-file\" id=\"edit-upload\" size=\"40\" /\x3e\n\n \x3cdiv class=\"description\"\x3eThe maximum
upload size is \x3cem\x3e1 MB\x3c/em\x3e. Only files with the following extensions may be uploaded:
\x3cem\x3ejpg jpeg gif png txt doc xls pdf ppt pps odt ods odp\x3c/em\x3e. \x3c/div\x3e\n\x3c/div\x3e
\n\x3cinput type=\"submit\" name=\"attach\" id=\"edit-attach\" value=\"Attach\" class=\"form-submit
\" /\x3e\n" }I have no idea what to do next to try to get this working. Any ideas what could be going on?
Comments
Still no luck
I still can't get this to work, despite a lot more digging. I found out exactly where in file.inc the upload issue occurs, but still am not sure what to do about it. Upload.module successfully calls file_save_upload() in file.inc. The problem arises on line 494 where the file fails the if statement due to the following bit of code:
<?phpis_uploaded_file($_FILES['files']['tmp_name'][$source])
?>
That statement is evaluated as false, the file fails upload, and no error is generated (does the lack of an error qualify as a bug?).
Anyone know where $_FILES['files']['tmp_name'][$source] gets set or how to fix this?
Any insight would be greatly appreciated. Thanks!
Does this work on your main domain?
I have the same problem (http://drupal.org/node/511394).
I am still trying to determine if it is Drupal or the server. Does this work for your main domain? If so it is presumably not a server problem.
The error message I got was:
{ "data": "\x3cdiv class=\"messages status\"\x3e\n\x3ca href=\"/admin/settings/site-maintenance\"\x3eOperating in off-line mode.\x3c/a\x3e\x3c/div\x3e\n\x3cdiv class=\"messages error\"\x3e\nAn unrecoverable error occurred. The uploaded file likely exceeded the maximum file size (2 MB) that this server supports.\x3c/div\x3e\n" }
It will refuse a file with the wrong extension in an appropriate way, but a file that is deliberately too big just fails invisibly.
Somewhere in my searching, someone said an error looking like this is a javascript/jquery error.
So glad I am not the only one -- but distressing that in 4 days noone has responded with help.
Cheers
Miriam
Miriam
Otaki, New Zealand
Web host did things for me
Now I can upload!
The webhost placed a php.ini file with the following code:
;;;;;;;;;;;;;;;;
; File Uploads ;
;;;;;;;;;;;;;;;;
; Whether to allow HTTP file uploads.
file_uploads = On
; Temporary directory for HTTP uploaded files (will use system default if not
; specified).
upload_tmp_dir = /home/username/tmp
; Maximum allowed size for uploaded files.
upload_max_filesize = 2M
Placed into this file structure:
etc
ftp
tmp [this is the : upload_tmp_dir = /home/username/tmp]
users
var
www / cgibin
www / htdocs / [drupal in here]
www / logs
www / php.ini
www / urchin5
Cheers
Miriam
Miriam
Otaki, New Zealand
Thank you, thank you!
Thank you, thank you! Adding home/username/tmp to my php.ini file worked like a charm. Problem finally solved!
Do you think we should file an issue with the upload.module to add an error message when this type of problem occurs to let people know what is going on? It was rather discouraging for nothing to happen at all.
Thanks again!
I added a comment to the
I added a comment to the handbook:
http://drupal.org/handbook/modules/upload
Miriam
Otaki, New Zealand