jagguy Posted November 25, 2006 Share Posted November 25, 2006 I want to copy an uploaded file to 2 locations instead of 1. I try to move the uploaded file to another directory again, but it fails.I tried to use copy copy( $_FILES['uploadedfile']['name'],$ff); and I triedcopy( $_FILES['uploadedfile']['tmp_name'],$ff).I don't know how to run a script and copy 1 file from 1 location to another.I thought this would be easy to do but I can't do it.if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'],$target_path.$filename)){echo "..>";}if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'],$target_path."thumbs\".$filename)){echo "..>";} Link to comment https://forums.phpfreaks.com/topic/28396-upload-the-file-twice/ Share on other sites More sharing options...
The Little Guy Posted November 25, 2006 Share Posted November 25, 2006 Look at these lines: move_uploaded_file()[code]<form action="" method="post" enctype="multipart/form-data"><p>Pictures:<input type="file" name="pictures[]" /><input type="submit" value="Send" /></p></form><?phpforeach ($_FILES["pictures"]["error"] as $key => $error) { if ($error == UPLOAD_ERR_OK) { $tmp_name = $_FILES["pictures"]["tmp_name"][$key]; $name = $_FILES["pictures"]["name"][$key]; move_uploaded_file($tmp_name, "data/location1/$name"); move_uploaded_file($tmp_name, "data/location2/$name"); }}?> [/code] Link to comment https://forums.phpfreaks.com/topic/28396-upload-the-file-twice/#findComment-129957 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.