Log in

View Full Version : Uploading a file to 2 directories



arsenalbates
02-22-2011, 09:10 PM
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 "

arsenalbates
02-22-2011, 09:17 PM
This is the whole code im using.

<?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