Results 1 to 2 of 2

Thread: creating an upload area

  1. #1
    Join Date
    May 2007
    Location
    England, UK
    Posts
    235
    Thanks
    3
    Thanked 6 Times in 6 Posts

    Question creating an upload area

    I'm trying to create an area so that people can upload files to my server.

    It doesn't need to be that secure as there will only be a select few people doing it, I will password the area.

    Does anyone know of a good PHP script I can use to do this?

    I have already created a form and below is the PHP script I'm using at the moment.
    The problem is, it won't work because PHP safemode is enabled.
    Any Ideas?

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

    /* Add the original filename to the target path.  
    Result is "/uploads/filename.extension" */
    $target_path $target_path basename$_FILES['uploadedfile']['name']); 
    $_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!";
    }


    ?>

  2. #2
    Join Date
    Mar 2006
    Location
    Cleveland, Ohio
    Posts
    574
    Thanks
    6
    Thanked 5 Times in 5 Posts

    Default

    I'm not sure what's wrong with that code specifically, but I have another script for uploading. I'll give it you if you want?
    Thou com'st in such a questionable shape
    Hamlet, Act 1, Scene 4

Bookmarks

Posting Permissions

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