Page 1 of 1

..copying files .. again...

Posted: Tue Nov 19, 2002 4:14 pm
by Fari
...simple script to copy a file from a client PC to the server (running Apache/Win2000/PHP4.2.3) results in the error message below. Script tested on two servers with same result.

Code: Select all

Warning: Unable to create '../images/': Permission denied in c:\program files\apache group\apache\htdocs\test\add_row_4.php on line 61
error message

code is:

Code: Select all

if (is_uploaded_file($new_stuffї$i])) 
  	 {
	  echo $new_stuff&#1111;$i]; echo"<BR>";
	  $temp = substr ( strrchr($new_stuff&#1111;$i] , "/"),1);
	  $dest_file_name = "../images/" . $temp; 
	  echo $dest_file_name;
	 
	  if (copy( $new_stuff&#1111;$i], $dest_file_name ))
	    &#123;
	      echo"<TR><TD></TD><TD>";
	      arial_2("File copied awlrait!!");
	      echo"</TD></TR>";
	      $new_stuff&#1111;$i] = $dest_file_name . ".jpg";
	    &#125;
....
&#125;

any ideas what's causing the problem?

Posted: Tue Nov 19, 2002 8:19 pm
by volka
obviously $temp is empty.
also php internally uses / as path seperator but you have to check for '\'' on uploaded files' name, too :(

...ja .. Volka .. thanks...

Posted: Wed Nov 20, 2002 5:36 am
by Fari
.. $temp was empty in that case .. eventually I got it working on my server (Win2000/Apache) but not working on the ISP's (suspect Linux/Apache) .. so will speak to him to figure out why ../images/file name not working on his.

Thanks a lot anyway!