Reputation: 12512
Is there a way to run a quick check what is the size of a file to be uploaded? I use a class that does it but I have to wait until it runs entirely before I can get that info. I would like to be able to skip going through the class if the file is larger, than say 5MB, i.e. don't even need it exactly if it is larger than max specified.
Thanks.
Upvotes: 0
Views: 879
Reputation: 17169
you can achieve this by using JavaScript/Mootools with flash.
Here is a plugin that does exactly that.
Fancyupload Demo w/ image file upload
Upvotes: 0
Reputation: 157839
you call it "uploaded" and misguide many people.
while you want to know filesize before upload.
but before file gets entirely uploaded, PHP isn't involved at all
Upvotes: 0
Reputation: 4196
Yep. There's a variable in the $FILES tree called "size" see details here:
http://www.php.net/manual/en/features.file-upload.post-method.php
Edit: also, you can set a max upload file size. You can set what php will accept, and put a hidden field in the html form to tell the browser what the max is (hopefully some browsers will do something intelligent with this.)
Upvotes: 1