Page 1 of 1
HTML: Handling Upload Size
Posted: Thu Jul 30, 2009 2:03 pm
by captcadaver
I'm working on an uploader for a photo gallery.
So, I've got a question about a certain attribute of the HTML input tag used here:
http://www.developershome.com/wap/wapUp ... ?page=php3
Code: Select all
<form action="file_upload.php" method="post" enctype="multipart/form-data">
<p>
<input name="MAX_FILE_SIZE" value="1048576" type="hidden"/>
<input name="myFile" type="file"/>
<input type="submit"/>
</p>
</form>
When you use MAX_FILE_SIZE and upload multiple files, does this look at the files' size as an aggregate or individually?
Re: HTML: Handling Upload Size
Posted: Thu Jul 30, 2009 2:10 pm
by jackpf
That's quite a good question xD
I'd imagine it applies to each individual input, but I'm not entirely sure. I didn't really find anything on google...
I do hope you're enforcing this server side though, as MAX_FILE_SIZE can be easily overridden.
Re: HTML: Handling Upload Size
Posted: Thu Jul 30, 2009 2:19 pm
by pickle
It's individual file size. This can be inferred from the fact that in PHP, $_FILES records an error for each individual file, not on the whole upload process. So it's possible to report different errors for different files.
Re: HTML: Handling Upload Size
Posted: Thu Jul 30, 2009 2:27 pm
by jackpf
The MAX_FILE_SIZE input doesn't relate to php though does it?
I thought it was for the browser to handle.
Re: HTML: Handling Upload Size
Posted: Thu Jul 30, 2009 2:46 pm
by pickle
It's supposed to be client-side, but that's never stopped any client I've used from trying to upload the file. PHP does have an error value for situations when the file exceeds that value - so those situations are accessible through PHP.
Re: HTML: Handling Upload Size
Posted: Thu Jul 30, 2009 3:57 pm
by jackpf
Oh right...I didn't know php paid any attention to that. Although that won't stop people using javascript, or simply rewriting the page to overcome that value...
Re: HTML: Handling Upload Size
Posted: Thu Jul 30, 2009 4:12 pm
by pickle
Ya. The docs state that is only meant as a convenience to the user, so they don't need to wait around if their file is too large.