Page 1 of 1

uploading script (the basics)

Posted: Wed Feb 21, 2007 8:48 pm
by jkashu
I have created a very basic file uploading script. What is needed in order to limited file size and accept only certain file extensions?

Posted: Wed Feb 21, 2007 9:29 pm
by Z3RO21
http://us2.php.net/features.file-upload The manual is a good place to start learning! Also try google. :)

Re: uploading script (the basics)

Posted: Wed Feb 21, 2007 9:48 pm
by Christopher
jkashu wrote:I have created a very basic file uploading script.
Excellent! You can post your code in the Code Critique and get valuable input on your code.
jkashu wrote:What is needed in order to limited file size
There is a MAX_FILE_SIZE parameter you can use in your form. However that does not prevent malicious circumvention. PHP has a ini setting for max_upload_size the is probably a better ultimate limiter. Best is to check the actual size of the temporary uploaded file and don't move it unless it is it your allowed size range.
jkashu wrote: and accept only certain file extensions?
The extension will not prevent malicious circumvention. You should inspect the actual file to determine its type. PHP has several functions for this.