PHP File Upload not working for larger images?
Is there any reason why the file upload wouldn't work for larger image files (size) when the max_file_size is set way higher than needed?
Documentation says that the max_file_size in the php.ini can cap whatever you have in the form, but other applications on similar servers have the ability to upload 225k images without problems through another script.
So assuming that the configuration is the same, is there any OTHER reason why an image that is more than 10kb would not copy properly over to the new directory when images smaller than that do (using the same script)?
Busy posted this at 21:49 — 30th November 2002.
He has: 6,151 posts
Joined: May 2001
This isn't the answer to your question but is related.
two people using the form at the same time can corrupt the item (text or image) unless provisions are set for this. (I'm trying to sort this out myself). also spaces in input (filename)
Also time outs can affect them if traffic to the database is heavy, but since your just testing doubt would be any of these.
Suzanne posted this at 23:03 — 30th November 2002.
She has: 5,507 posts
Joined: Feb 2000
Well if nothing else, I can rule out those problems...
The upload_max_blahblah is set to 2M, the max_file_size is set to 1200000 (which ought to really be more than enough for a 35000b file).
None of the images have spaces (they are all one word names like yucca.jpg).
I'm the only one with access to the script.
Traffic to the database is painfully light.
So... now that we've eliminated possible causes (thanks, Busy!), what is left?
The thumbnails upload like a dream, just float on in there. The larger images appear to upload, but are 0kb when they get to the final directory.
Ideas on what to look for would be great! I don't even know what to call this, lol...
Mark Hensler posted this at 23:32 — 30th November 2002.
He has: 4,048 posts
Joined: Aug 2000
Have you tried that other script on this server?
Did you write the script your using or download it somewhere?
Timeout was the first thin I thought of. The max_execution_time is typically set to 30 seconds, which should really be enough. You might try extending this just to try it:
set_time_limit(30);
Another (unlikely) cause -- does the destination upload directory (the tmp directory) have enough space?
Mark Hensler
If there is no answer on Google, then there is no question.
Suzanne posted this at 00:17 — 1st December 2002.
She has: 5,507 posts
Joined: Feb 2000
The other script is Gallery, and it's quite a lot of effort to download it, configure it and set it up just to test, but I suppose, lol, if I can't get it right, I will!
I don't know where to find the tmp directory?
Yes, I wrote it, or rather, put it together using a bunch of other scripts, including http://www.php.net/manual/sk/printwn/features.file-upload.php where a user seems to have a similar problem but no solution?
The problem for me is that it works for small images, but not larger ones. So clearly it's working to some extent -- it's just the file size? I tried changing MAX_FILE_SIZE to max_file_size and such, but it didn't seem to have an effect.
Suzanne posted this at 01:03 — 1st December 2002.
She has: 5,507 posts
Joined: Feb 2000
okay, I'm totally flummoxed now. I used a script from Web Blazonry and removed the resizing part and it works fine. With the resizing part, I had the same errors as I was getting with my own (i.e. file saved as 0b).
!?
Okay, not going to think about it. Thanks for helping me rule things out. I'm going to assume I had a bad space or misplaced semi-colon or something and run with it.
Suzanne posted this at 22:52 — 1st December 2002.
She has: 5,507 posts
Joined: Feb 2000
K, I figured out what the problem was -- I was trying to include resizing without having the correct modules installed, so it was failing at the resize level, something the thumbnails avoided by being too small.
So there you go.
Mark Hensler posted this at 02:42 — 2nd December 2002.
He has: 4,048 posts
Joined: Aug 2000
What's missing? The GD support?
Suzanne posted this at 03:01 — 2nd December 2002.
She has: 5,507 posts
Joined: Feb 2000
The bits listed on this page: http://www.blazonry.com/scripting/upload-size.php
"djpeg, cjpeg and pnmscale"
I was initially attempting to use this script, before I got involved with 4 other tutorials and scripts and basically got myself all turned around inside out and sideways and apparently left in the resizing part when changing the rest.
However! I did manage to get it working, so I'm quite pleased about that part.
Your job is SO not in danger from me... :eek:
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.