The File That Shags Me.... a file upload film
Posted: Mon Aug 15, 2005 1:14 am
Hi, I don't know if there's a thread similar to my problem but to make it fresh i would ask it anyway.
I have been working on a file upload script and the form goes like this
*note: some functions are user-defined
The form will let users to select any file then a script will filter and process it according to what is passed to $_FILES['file'].
Now what I want to happen is to restrict the selection of file to only one extension before submission, for example, only MS Excel files. Is this possible? Do I have to put more parameters to my form to do this? or another hidden field, just like MAX_FILE_SIZE?
Thanks in advance.
I have been working on a file upload script and the form goes like this
Code: Select all
$str = "
<font class=blue>FILE UPLOAD</font><p>
".$this->message."
<form name=uploadform method=post action='' enctype='multipart/form-data'>
".Hidden('MAX_FILE_SIZE','200000')."
Enter the Path to ".$this->documents[$this->cur_doc]->getTitle()." file<p>
<input type=file name=file size=50><p>
".Button('upload','',"if(file.value) submit()")."
</form>";
echo $str;The form will let users to select any file then a script will filter and process it according to what is passed to $_FILES['file'].
Now what I want to happen is to restrict the selection of file to only one extension before submission, for example, only MS Excel files. Is this possible? Do I have to put more parameters to my form to do this? or another hidden field, just like MAX_FILE_SIZE?
Thanks in advance.