Hi,
How can I get the filesize and filetype for a 'soon-to-be uploaded' file.
What I'm trying to do is :
Someone needs to upload a file, but for those modem users it's a pain spending 30 min uploading, just to be told that the file they have uploaded is not supported.
- Make a form with a browse button, the user selects the file and hits submit.
- Check the file .. Size < xxxx , type = "xxxx"
- (2)=ok .. continue upload, else 'make some noise'
So any 'hacks' to do a :
if ($FILE[userfile][type] == "image/png")
{
continue_upload($FILE[userfile][name]);
}
else
{
echo "File type invalid";
}
or a
if ($_FILE[userfile][size] > 1M😎
{
ask_user("Uploading this file could take a while","continue","cancel");
}
If it's not possible in PHP, how about a javascript ??
DaGeek 🙂