944,053 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 601
  • PHP RSS
Oct 23rd, 2009
0

Permision issues with uploading files

Expand Post »
Hi,
I have created a script to upload files
php Syntax (Toggle Plain Text)
  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
PHP Syntax (Toggle Plain Text)
  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.
Similar Threads
Reputation Points: 26
Solved Threads: 31
Posting Whiz
samarudge is offline Offline
354 posts
since May 2008
Oct 23rd, 2009
0
Re: Permision issues with uploading files
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.
Reputation Points: 29
Solved Threads: 76
Practically a Master Poster
network18 is offline Offline
616 posts
since Sep 2009

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: Ajax text to select
Next Thread in PHP Forum Timeline: Qn About Tables and Images





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC