Upload images to my server??

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
User avatar
lazersam
Forum Contributor
Posts: 105
Joined: Sat Nov 15, 2003 4:07 am
Location: Hertfordshire, UK

Upload images to my server??

Post by lazersam »

Hi all

I am trying to write a real simle script that uploads a pic from the clients pc to my sevrer.

The form seems ok. The address to the pic is stored in $pic1.

The handler script looks like this...

Code: Select all

<?php
$root = $_SERVER['DOCUMENT_ROOT'];
		
		
		$pic1 = stripslashes($pic1);
		
		echo "pic1 = $pic1 <br>";
		echo "root = $root <br>";
		
		
		 copy ("$pic1", '$root/SuperAd/MembersArea/temp_pics/$t_pic1'   )
		 or die ("Could not copy file"  );
		 
				 
		 echo "pic1_name = $pic1_name <br>";
		 echo "pic1_size = $pic1_size <br>";
		 echo "pic1_type = $pic1_type <br>";
?>
I keep getting an error..
Warning: copy(C:\*****\calvin.gif): failed to open stream: No such file or directory in /*****/premium_handler.php on line 15
Could not copy file
Any ideas?

Thanks

Lawrence.
litebearer
Forum Contributor
Posts: 194
Joined: Sat Mar 27, 2004 5:54 am

Post by litebearer »

User avatar
lazersam
Forum Contributor
Posts: 105
Joined: Sat Nov 15, 2003 4:07 am
Location: Hertfordshire, UK

Post by lazersam »

litebearer wrote:try this...

http://codewalkers.com/faq/2/28.html


Lite...
Thanks - thats very useful :)

Lawrence.
Post Reply