doubledee Posted June 8, 2012 Share Posted June 8, 2012 I am wondering if anyone can help me track down this known issue that I forgot to document and can't find?! If you try to upload a really small file in PHP, it was either < 4 Bytes or < 4 Kilobytes it crashes on of PHP's Functions related to uploading files, OR it may have been with GD. I know this error exists because I encountered it myself, and it took me a day of researching to find a solution. (You'd think I would have been smarter and documented the hell out of it afterwards...) BTW, my script is working fine, I am just going back and adding more documentation so stuff like this doesn't get lost! Thanks, Debbie Quote Link to comment Share on other sites More sharing options...
Drummin Posted June 8, 2012 Share Posted June 8, 2012 Do you get an error code when uploading? $_FILES["file"]["error"]; I don't see an error code, for too small... Maybe something else? Quote Link to comment Share on other sites More sharing options...
doubledee Posted June 8, 2012 Author Share Posted June 8, 2012 Do you get an error code when uploading? $_FILES["file"]["error"]; I don't see an error code, for too small... Maybe something else? I don't know what would cause the error. That is whole point of this thread... Trying to jog my memory or someone else's as to why a really small File (e.g. 4 Bytes) would break one of PHP's of GD's Functions related to handling and manipulating Uploaded Files. Debbie Quote Link to comment Share on other sites More sharing options...
Drummin Posted June 8, 2012 Share Posted June 8, 2012 The point of echoing $_FILES["file"]["error"]; is so you can find out how the file was handled. It would say 0 if there was not a problem and uploaded to temp. Quote Link to comment Share on other sites More sharing options...
Jessica Posted June 8, 2012 Share Posted June 8, 2012 Is a 4 byte file even going to be a valid image? I'd think that might cause GD to fail. Quote Link to comment Share on other sites More sharing options...
doubledee Posted June 9, 2012 Author Share Posted June 9, 2012 The point of echoing $_FILES["file"]["error"]; is so you can find out how the file was handled. It would say 0 if there was not a problem and uploaded to temp. I can't recreate the error, but want to find out what and where it would fall, so if it happens - like it did in the past - I have code to handle it. Debbie Quote Link to comment Share on other sites More sharing options...
scootstah Posted June 9, 2012 Share Posted June 9, 2012 The lowest I could get a 1x1px image was 43 bytes. I did a quick test and both file uploads and GD manipulation work fine. Quote Link to comment Share on other sites More sharing options...
doubledee Posted June 9, 2012 Author Share Posted June 9, 2012 The lowest I could get a 1x1px image was 43 bytes. I did a quick test and both file uploads and GD manipulation work fine. Guess you guys just have to trust me on this one that it is a known issue... Maybe if I go through my old threads I can find it, but that could take forever?! Well, my "Photo must be at least 4kb" will handle that for now. Debbie Quote Link to comment Share on other sites More sharing options...
doubledee Posted June 9, 2012 Author Share Posted June 9, 2012 I'm pretty sure that what I am describing is documented *somewhere* out in the PHP Manual, but I just can't find it... Debbie Quote Link to comment Share on other sites More sharing options...
requinix Posted June 9, 2012 Share Posted June 9, 2012 Which function is causing the problem? getimagesize()? Historically it's had a couple problems dealing with very tiny files. Quote Link to comment Share on other sites More sharing options...
doubledee Posted June 9, 2012 Author Share Posted June 9, 2012 Which function is causing the problem? getimagesize()? Historically it's had a couple problems dealing with very tiny files. That's what I am asking help to figure out?! When I was adding tomes of documentation to my script today, I recalled this odd-ball issue. All I remember, is that a really small file would cause one of the functions to "cough" and give an error or wrong results. I think it was like 4 Bytes, but I did some testing and decided to require at least 4 KiloBytes instead to be safe. It seems like this was documented somewhere in the PHP Manual in the sction talking about File Uploads. (It must have been one of the functions like you mention, but I'm not sure?!) Being a nut on DOCUMENTATION and ERROR-HANDLING, I would like to find what I am talking about - assuming I am not imaging things - and read up on it, make sure I am properly handling for it, and then writing a mini-paragraph on it, so when this comes up again, I know what is going on!!! Not much help, I know, but that is why I am asking you guys for help!! Debbie Quote Link to comment Share on other sites More sharing options...
requinix Posted June 9, 2012 Share Posted June 9, 2012 It seems like this was documented somewhere in the PHP Manual in the sction talking about File Uploads. (It must have been one of the functions like you mention, but I'm not sure?!) A partial upload. There's an error code for that. Quote Link to comment Share on other sites More sharing options...
smoseley Posted June 9, 2012 Share Posted June 9, 2012 There's no such thing as a valid 4 byte image. The mime header alone is bigger than that. So your file was obviously corrupted, which is why GD was choking on it. Quote Link to comment Share on other sites More sharing options...
scootstah Posted June 9, 2012 Share Posted June 9, 2012 There's no such thing as a valid 4 byte image. The mime header alone is bigger than that. So your file was obviously corrupted, which is why GD was choking on it. Or it wasn't an image at all. Quote Link to comment Share on other sites More sharing options...
doubledee Posted June 9, 2012 Author Share Posted June 9, 2012 I looked at all of the comments for getimagesize() in the Manual with no luck. Looks like this one is going to get away... Debbie Quote Link to comment Share on other sites More sharing options...
requinix Posted June 9, 2012 Share Posted June 9, 2012 So this isn't resolved then? What version of PHP are you using? Oh, and find out where the problem is exactly. Quote Link to comment Share on other sites More sharing options...
scootstah Posted June 10, 2012 Share Posted June 10, 2012 I looked at all of the comments for getimagesize() in the Manual with no luck. Looks like this one is going to get away... Debbie I ran getimagesize() against my previously mentioned 1x1px image @ 43 bytes and there's no problems. I don't know what your problem was, but I'm going to take a shot in the dark and say you weren't testing a valid image. Quote Link to comment Share on other sites More sharing options...
doubledee Posted June 10, 2012 Author Share Posted June 10, 2012 So this isn't resolved then? What version of PHP are you using? Oh, and find out where the problem is exactly. Requinix, you haven't been listening... My code works fine right now. But I seem to recall this bug/issue/whatever, and I can't find any notes on it in my code, on my laptop, or in the Manual, even though I *swear* I remember reading about it, discussing it, and fixing it. Being thorough, I was trying to find out what I can't remember might be, so I am 110% my code does handle it. (With so many changes and versions, I could have wrote a great block of code to handle this with comments, and some how deleted it?!) Every one here is saying I'm imaging things and there isn't an issue, but I am still sure of what I have been able to describe. And unless I can find what I am talking about online, or my code crashes and I experience this "ghost bug", then I'll just have to move on, because I obviously can't remember anymore, and I'm not triggering anything in any of your heads. Oh well. Debbie Quote Link to comment Share on other sites More sharing options...
Adam Posted June 10, 2012 Share Posted June 10, 2012 My code works fine right now. But I seem to recall this bug/issue/whatever, and I can't find any notes on it in my code, on my laptop, or in the Manual, even though I *swear* I remember reading about it, discussing it, and fixing it. [...] Every one here is saying I'm imaging things and there isn't an issue, but I am still sure of what I have been able to describe. Nobody is saying you're imaging it, but given the inability to reproduce the problem it's probably such an edge case that it's not worth worrying about. You say you encountered it before, so you should be able to reproduce it? You can't ask a bunch of devs to help you fix an issue you can't explain or give steps to reproduce. Quote Link to comment Share on other sites More sharing options...
doubledee Posted June 10, 2012 Author Share Posted June 10, 2012 My code works fine right now. But I seem to recall this bug/issue/whatever, and I can't find any notes on it in my code, on my laptop, or in the Manual, even though I *swear* I remember reading about it, discussing it, and fixing it. [...] Every one here is saying I'm imaging things and there isn't an issue, but I am still sure of what I have been able to describe. Nobody is saying you're imaging it, but given the inability to reproduce the problem it's probably such an edge case that it's not worth worrying about. You say you encountered it before, so you should be able to reproduce it? You can't ask a bunch of devs to help you fix an issue you can't explain or give steps to reproduce. Well, I was hoping I gave enough that someone would say, "Oh yeah, what you are describing a _____. And the way to fix it is _____. Ad you can find articles on it here." Oh well. Thanks anyways. Debbie Quote Link to comment Share on other sites More sharing options...
requinix Posted June 10, 2012 Share Posted June 10, 2012 You can't tell us where the problem is or what function is causing it, and you haven't given us what we need to reproduce the problem on our ends. It should not be surprising that we can't tell you what the solution is. Quote Link to comment Share on other sites More sharing options...
smoseley Posted June 10, 2012 Share Posted June 10, 2012 ...Every one here is saying I'm imaging things... Nobody is saying you're imaging it... Haha, well she's definitely imaging it, though probably not imagining it. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.