Friday, 19 April 2013

PHP File Upload


PHP file upload.
With PHP allows the user to upload files to the server.

Create File upload form.
Form is very useful to allow users to upload files to the server

EXAMPLE file_upload.php
The source code is action="upload.php" method="POST" enctype="multypart/form-data">
<label for="file"> Filename: </ label>
<input type="file" name="file" /> <br />
<input type="submit" value="Upload" />
</ form>

After we finished creating files whose names file_upload.php now we will make the file upload.php.
upload.php file

Note:
Before we run the script upload the file we will create a new folder called upload misalx that, whatever may be the name of the folder up and.


<? php
move_uploaded_file ($ _file ['file'] ['tmp_name'], 'upload /'. $ _file ['file'] ['name']);
?>

Caki-Footnote-
$ _file ['File'] ['name'] - To know the file name in the upload.
$ _file ['File'] ['type'] - To determine the file type.
$ _file ['File'] ['size'] - To determine the size of the file.
$ _file ['File'] ['error'] - Checking error in the file.
$ _file ['File'] ['tmp_name'] - The place where the file will be saved.

No comments:

Post a Comment