Hello experts, I want to upload same image into 2 different folder by one submit button.But i can not do it. Here is my code .Please help me. <?php if ($_POST['upload']) { $p1=$_FILES["imageName"]["name"]; $t1=$_FILES["imageName"]["tmp_name"]; $p2=$_FILES["imageName"]["name"]; $t2=$_FILES["imageName"]["tmp_name"]; if(move_uploaded_file($t1 , "original/" . $p1)) { move_uploaded_file($t2,"active/" . $p2); } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> </head> <body> <form name="frm" method="post" action="<?php $_SERVER['PHP_SELF']?>" enctype="multipart/form-data"> <input type="file" name="imageName" /><input type="submit" name="upload" value="upload" /> </form> </body> </html> Thanks....
I suggest you use copy() PHP: function. You know path to uploadad file after move_uploaded_file() - then just copy it.
do something more along the lines of if(is_uploaded_file($uploadedfile)) { copy($uploadedfile,$dest1); rename($uploadedfile,$dest2) }