..copying files .. again...

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Fari
Forum Commoner
Posts: 42
Joined: Thu Sep 19, 2002 8:41 pm
Location: Timmins - Ontario

..copying files .. again...

Post 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?
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

obviously $temp is empty.
also php internally uses / as path seperator but you have to check for '\'' on uploaded files' name, too :(
Fari
Forum Commoner
Posts: 42
Joined: Thu Sep 19, 2002 8:41 pm
Location: Timmins - Ontario

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

Post 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!
Post Reply