Upload file using PHP
HTML CodingIn this example .i will show How upload file using PHP.we are two program here.one is HTM and PHP program.
In the HTML file get the file and send to the PHP program using POST method.
<html> <body> <form action="upload.php" enctype="multipart/form-data" method="post"> Select the file to upload<input name="upload" type="file" /> </form> </body> </html> |
PHP Coding
<?php $uploadddr='upload/'; $uploadfile=$uploaddr.basename($_FILE[''file']['name']); if(move_uploaded_file($_FILE['file']['tmp_name'].$uploadfile)) { echo "file is valid"; } else { echo "file uploading failed"; }?> |
PHP Program Explaination:
In the PHP program will get the file stored in file called upload.You must create upload folder in your Computer.
0 comments:
Post a Comment