Jump to content

Super-small File causes Upload Error?


doubledee

Recommended Posts

I am wondering if anyone can help me track down this known issue that I forgot to document and can't find?!  :shrug:

 

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

 

Link to comment
Share on other sites

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

 

Link to comment
Share on other sites

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

 

Link to comment
Share on other sites

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?!  :o

 

Well, my "Photo must be at least 4kb" will handle that for now.

 

 

Debbie

 

Link to comment
Share on other sites

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!!  :P

 

 

Debbie

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

 

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

 

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.