PHP handling file uploads

PHP handling file uploads

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

Example:
<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
PHP creating and deleting directories
Creating directories: PHP’s mkdir() can be used to create directories. It takes two parameters; path to desired directory and the permission..
PHP creating, moving, copying and deleting files
PHP creating, moving, copying & deleting files - Copy files: Copies files from “source” to “destination”. If the destination file exists it will be overwritten. it returns true on success...
Post your comment