Return to Snippet

Revision: 20870
at November 28, 2009 13:16 by suibhne


Initial Code
$target_path = "uploads/";
$target_path = $target_path . basename( $_FILES['uploadedfile']['name']); 

if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
    echo "The file ".  basename( $_FILES['uploadedfile']['name'])." has been uploaded";
} else{
    echo "There was an error uploading the file, please try again!";
}

Initial URL


Initial Description
Just a simple piece of code to store an uploaded file in PHP.

Initial Title
PHP File Upload

Initial Tags
php

Initial Language
PHP