Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

COPY function not working

Status
Not open for further replies.

lagc

Programmer
Jan 21, 2009
79
GB
A little ahile ago we where hacked and as a result the hosting company made us lock down the folders, which in honesty was fair enough as they werent secure.

Anyway, we have an admin system that uploads hotels to the server, and since we have secured the image folders, we cant upload images using the code below, as we get this error.

Code:
Warning: copy(imgdata/hotel/6702Fram.gif) [function.copy]: failed to open stream: Permission denied in /home/checksaf/public_html/en/admin1212/admin_hotels.php

this is the code here:

Code:
$src1=$_FILES['file1']['tmp_name'];
					$fname1=rand(0,9999).$_FILES['file1']['name'];
			
					$src2=$_FILES['file2']['tmp_name'];
					$fname2=rand(0,9999).$_FILES['file2']['name'];
			
					$src3=$_FILES['file3']['tmp_name'];
					$fname3=rand(0,9999).$_FILES['file3']['name'];		
			
					$src4=$_FILES['file4']['tmp_name'];
					$fname4=rand(0,9999).$_FILES['file4']['name'];						
			
copy("$src1","imgdata/hotel/$fname1");		
					copy("$src2","imgdata/hotel/$fname2");		
					copy("$src3","imgdata/hotel/$fname3");		
					copy("$src4","imgdata/hotel/$fname4");

Its creating a lot of problems, as we now have to not upload any images so the code kicks in for no image being uploading, and then i have to upload the image to the image folder via FTP and then go into cpanel and cut and paste the image name in.

Cheers
 
Sounds like you don't have the proper permissions assigned either at the folder or file level, if not both. Either that, or the admin function needs to be run by or associated somehow with the ownership of said folder/file, so that you can allow access to the owner, but not "everybody". Using an FTP program is an easy way to check the permissions for individual files and folders on an http server.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top