Click to See Complete Forum and Search --> : Get filesize of files before allowing upload


pickslap
03-25-2003, 07:40 AM
Hi Freaks,

I want to allow users uploading files with a filesize not more than 5 MB. How can I check the filesize of a file that a user selected, before or when beginnning the upload ?

Is this somehow possible with JS ?

:confused:

Steffen

pyro
03-25-2003, 08:11 AM
No, you are going to need to use the server side language that you are using to handle the file upload. If it is PHP, I can help you...What are you using?

pickslap
03-25-2003, 09:10 AM
Originally posted by pyro
No, you are going to need to use the server side language that you are using to handle the file upload. If it is PHP, I can help you...What are you using?

Yes, I'm using PHP, how are you doing it....

pyro
03-25-2003, 09:43 AM
Ok, basically what you will want to do is check the file size. Take a look at this:

if ($inputfile_size <= 5000000) # $inputfile is the name of your form field that handles the files
{
#upload code here
}
else
{
echo ("File size must be 5 MB or less");
}

If you need more help, let me know.