Results 1 to 2 of 2

Thread: Uploading a file to 2 directories

  1. #1
    Join Date
    Dec 2010
    Posts
    30
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Exclamation Uploading a file to 2 directories

    Is it possible to send an uploaded file to 2 areas.
    e.g send it to folder A and folder B


    $target_path = "../$user/Uploads/";
    this is the code to send it to the single location


    In pseudo it should look like this

    $target_path = "../$user/Uploads/" + " second location "

  2. #2
    Join Date
    Dec 2010
    Posts
    30
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    This is the whole code im using.
    PHP Code:
    <?php


    $user 
    $_SESSION['username'];
    $target_path "../$user/Uploads/" "../dean/";



    Result is "uploads/filename.extension" */
    $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<br>");
    print <<<HTML
    <a href="show.php">click here to view the image</a>
    HTML;

    } else{        
        echo 
    "There was an error uploading the file, please try again!";
    }



    ?>
    This code dont work and just places the file in its own directory

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
  •