PHP handling file uploads
PHP handling file uploads - Dec 13, 2008 at 22:00 PM by Rajmeet
Ghai
PHP handles file uploads through different method.
POST method uploads: This allows user to upload both text and
binary files. PHP has a number of authentication and file manipulation
functions, a control over upload is possible.
Files can be uploaded in PHP by using the tag type=”file”. An upload form must
have encytype="multipart/form-data" , method also needs to be set to
method="post". Also, hidden input MAX_FILE_SIZE before the file input. To
restrict the size of files
E.g.
<form enctype="multipart/form-data" action="sampleuplaod.php"
method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="1000" />
Finally, using move_uploaded_file () the file can be uploaded. Parameters will
be source file and destination file
|