title: php copy() does not work
body: <p>I want to do a simple copy using a ajax call. this is my code but it does not work . i kepp getting : a copy(../../images/merchant/particulars/208/) failed to open stream: Is a directory in         some/filepath on scriptname.php line x , kind of error.    </p>
  
  <pre><code>corrected code: 
  
  $dir_to_make = '../../images/merchant/particulars/'.$copytothisstore;
  $dir = '../../images/merchant/particulars/'.$copytothisstore.'  /'.$copyvalue;
  $image_to_copy = '../../images/merchant/particulars/'.$copyfromthisstore.'/'.$copyvalue;
  
  
  
  
  
  
      if(is_file($image_to_copy)){
  
          //chk if there is a folder created for this store
          if(!is_dir($dir_to_make)){
                mkdir($dir_to_make, 0755);  
                chmod($dir_to_make, 0755);
  
                //copy the image 
                if (!copy($image_to_copy,$dir)) {
                    echo "failed to copy $image_to_copy\n";
                } else {
                    echo"all is well!!";
                }
  
             } else {
                 chmod($dir_to_make, 0755);
                 if (!copy($image_to_copy,$dir)) {
                    echo "failed to copy $image_to_copy\n";
                } else {
                    echo"all is well!!";
                }
  
             }
  
  
             echo"$image_to_copy does exist!";
          } else{
              echo"$image_to_copy does not exist!";
          }
  </code></pre>