NextIndexPrevious

Programs in PHP

16. Program to Upload a file to the Server.

form1.php

<html> <head> </head> <body> <form method="post" action="upload.php" enctype="multipart/form-data"> Resume : <input type="file" name="f1"> <br><input type="submit" value="Upload"> </form> </body> </html>

upload.php

<?php if(is_uploaded_file($_FILES['f1']['tmp_name'])) { $fname = $_FILES['f1']['name']; if(move_uploaded_file($_FILES['f1']['tmp_name'],"uploads/$fname")) { echo "Uploaded successfully"; } else { echo "Not uploaded"; } } ?>

Father of PHP

Rasmus Lerdorf

Rasmus Lerdorf

Born: November 22, 1968, Greenland
Google+