Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2

Thread: upload file

  1. #1
    Regular Coder
    Join Date
    Aug 2005
    Posts
    279
    Thanks
    0
    Thanked 0 Times in 0 Posts

    upload file

    I have this code from an online tutorial:

    PHP Code:
    // Where the file is going to be placed 
    $target_path "uploads/";

    /* Add the original filename to our target path. Result is "uploads/filename.extension" */
    $target_path $target_path basename$_FILES['uploadedfile']['name']); 

    // This is how we will get the temporary file...
    $_FILES['uploadedfile']['tmp_name']; 

    $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!";

    I created the uploads directory, and uploaded that code to my php webhost, but I kept getting "There was an error uploading the file, please try again!"

  • #2
    New to the CF scene
    Join Date
    May 2005
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Have you CHMOD'ed the "uploads" directory to 777 ?


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •