Permision issues with uploading files

Reply

Join Date: May 2008
Posts: 250
Reputation: samarudge is an unknown quantity at this point 
Solved Threads: 20
samarudge samarudge is offline Offline
Posting Whiz in Training

Permision issues with uploading files

 
0
  #1
Oct 23rd, 2009
Hi,
I have created a script to upload files
  1. $filename = $_FILES['Filedata']['name'];
  2.  
  3. $filetmpname = $_FILES['Filedata']['tmp_name'];
  4.  
  5. $fileType = $_FILES["Filedata"]["type"];
  6.  
  7. $fileSizeMB = ($_FILES["Filedata"]["size"] / 1024 / 1000);
  8.  
  9. //Irrelevant validation here
  10.  
  11. move_uploaded_file($_FILES['Filedata']['tmp_name'], $_SERVER['DOCUMENT_ROOT']."/content/songs/file.mp3");

And that returns OK to the browser allong with my success message but the file doesn't exist, when I look in the sites error log i get
  1. [Fri Oct 23 09:53:44 2009] [error] [client 192.168.0.1] PHP Warning: move_uploaded_file(Photo on 2009-10-09 at 22.51 #2.jpg) [<a href='function.move-uploaded-file'>function.move-uploaded-file</a>]: failed to open stream: Permission denied in /var/www/html/development/scripts/open/signup/uploadtest.php on line 25, referer: http://dev-env-1.samrudge.co.uk/account/main
  2. [Fri Oct 23 09:53:44 2009] [error] [client 192.168.0.1] PHP Warning: move_uploaded_file() [<a href='function.move-uploaded-file'>function.move-uploaded-file</a>]: Unable to move '/phptemp/phpTxmy2f' to 'Photo on 2009-10-09 at 22.51 #2.jpg' in /var/www/html/development/scripts/open/signup/uploadtest.php on line 25, referer: http://dev-env-1.samrudge.co.uk/account/main

/phptemp/ has CHMOD 777 and apache has read write access to the entire web directory

Whats wrong?
Thanx,
Sam
Last edited by samarudge; Oct 23rd, 2009 at 6:02 am.
My Blog, Life and everything that matters to me - SamRudge.co.uk

2x Macbook Pro's, 1x Mac Pro, 1x iMac, 2x Macbook's running Fedora linux - In conclusion, I hate windows =)
Reply With Quote Quick reply to this message  
Join Date: Sep 2009
Posts: 539
Reputation: network18 is an unknown quantity at this point 
Solved Threads: 63
network18 network18 is offline Offline
Posting Pro
 
0
  #2
Oct 23rd, 2009
by the error logs it seems that your code is not able to access the file,check the permissions to that file.sometimes it might be the case that the file is permitted but the folder outside of it not , so check with that too.
Last edited by network18; Oct 23rd, 2009 at 6:08 am.
"The discipline of writing something down is the first step towards making it happen."

follow me on twitter
Reply With Quote Quick reply to this message  
Reply

Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC