image upload form 1

image upload form

//This is the minimal code for an image upload for first time learners
//html portion



//php portion "; echo "File Name:: ".$image['name']; move_uploaded_file($image['tmp_name'],"photos/".$image['name']); //here the "photos" folder is in same folder as the upload.php, //otherwise complete url has to be mentioned ?>

Here is what the above code is Doing:
1. The form is submitted to the upload.php file.
2. The $_POST[‘username’] is used to get the username entered in the form.
3. The $_FILES[‘myfile’] is used to get the file uploaded in the form.
4. The move_uploaded_file() function is used to move the file from the temporary location to the desired location.

Similar Posts