views:

76

answers:

2

i have one image upload script which upload same image on two locations same time with move_uploaded_file() function like this

  $fpath="../p/e/".$prop_fac1;
  $error = move_uploaded_file($tmp_name, $fpath);

  $fpath1="../p/t/".$prop_fac1;
  $error1 = move_uploaded_file($tmp_name, $fpath1);

the problem is, first part works mean it upload files to ../p/e but not copy file to second location...

+2  A: 

the problem is, first part works mean it upload files to ../p/e but not copy file to second location...

Works as designed. The file is moved, not copied. Use copy() for the second command, using the target path from the first one.

 $error1 = copy($fpath, $fpath1);
Pekka
+1  A: 

That would be because it's MOVE_uploaded_file, not COPY_uploaded_file. What you need to do is:

move_uploaded_file($tmp_name, $fpath);
copy($fpath, $fpath1);
cypher