Give better error messages in the example upload.php #629

Closed
wants to merge 2 commits into
from

Conversation

Projects
None yet
3 participants
@odinho

odinho commented Oct 5, 2012

Many people just need a quick uploader, and use the embedded example code. I actually thought the code was wrong, which it wasn't, but found my real error after actually printing out the error code that PHP provides.

This patch exposes that error code (along with a helpful message).

@mehran20

This comment has been minimized.

Show comment Hide comment
@mehran20

mehran20 Oct 5, 2012

Sorry but:

-if (strpos($contentType, "multipart") !== false) {
+if (!strstr($contentType, "multipart")) {

didn't fix the problem for me! The uploaded file is 0 bytes while before this no file was created in the server. I'm using Chromium Version 20.0.1132.47 Ubuntu 12.04 (144678).

mehran20 commented Oct 5, 2012

Sorry but:

-if (strpos($contentType, "multipart") !== false) {
+if (!strstr($contentType, "multipart")) {

didn't fix the problem for me! The uploaded file is 0 bytes while before this no file was created in the server. I'm using Chromium Version 20.0.1132.47 Ubuntu 12.04 (144678).

@odinho

This comment has been minimized.

Show comment Hide comment
@odinho

odinho Oct 5, 2012

@mehran20 Hmm, you're in fact totally correct.

It's a totally different problem (on my side, and potentially at yours too):

upload_max_filesize is too small: http://no.php.net/manual/en/ini.core.php#ini.upload-max-filesize

odinho commented Oct 5, 2012

@mehran20 Hmm, you're in fact totally correct.

It's a totally different problem (on my side, and potentially at yours too):

upload_max_filesize is too small: http://no.php.net/manual/en/ini.core.php#ini.upload-max-filesize

@mehran20

This comment has been minimized.

Show comment Hide comment
@mehran20

mehran20 Oct 5, 2012

No that's not it. I've set the upload_max_filesize to 20M and the file I'm trying to upload is 5M but the file created on server is 0 byte.

mehran20 commented Oct 5, 2012

No that's not it. I've set the upload_max_filesize to 20M and the file I'm trying to upload is 5M but the file created on server is 0 byte.

@odinho

This comment has been minimized.

Show comment Hide comment
@odinho

odinho Oct 5, 2012

Okay, you have prolly a different problem then. But try this patch, it will might give you a better error message.

odinho commented Oct 5, 2012

Okay, you have prolly a different problem then. But try this patch, it will might give you a better error message.

@jayarjo

This comment has been minimized.

Show comment Hide comment
@jayarjo

jayarjo Jan 27, 2013

Owner

@mehran20 were you able to upload the file the old way after you enlarged upload_max_filesize? Check my response in #589.

@velmont in general upload.php is just an example. You can enhance it in any way you find appropriate. However we do not plan to expand it any further. Opposite in fact - I'm looking to cut it down :)

Owner

jayarjo commented Jan 27, 2013

@mehran20 were you able to upload the file the old way after you enlarged upload_max_filesize? Check my response in #589.

@velmont in general upload.php is just an example. You can enhance it in any way you find appropriate. However we do not plan to expand it any further. Opposite in fact - I'm looking to cut it down :)

@jayarjo jayarjo closed this Jan 27, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment