By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,704 Members | 1,630 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,704 IT Pros & Developers. It's quick & easy.

permission denied for upload

P: 41
hi all

i am uploading an image on live linux hosting server and getting the below error

Expand|Select|Wrap|Line Numbers
  1. Warning: move_uploaded_file(../graphics/home_bigad2.jpg) [function.move-uploaded-file]: failed to open stream: Permission denied in /home/gads/public_html/vineet/admin/add_special_offer.php on line 12
  2.  
  3. Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phpXjKkp7' to '../graphics/home_bigad2.jpg' in /home/gads/public_html/vineet/admin/add_special_offer.php on line 12
  4.  
  5.  
This is my php code
Expand|Select|Wrap|Line Numbers
  1. <?php require_once("../config.php");
  2.  
  3. $msg="";
  4.  
  5. if(isset($_REQUEST['submit']))
  6. {
  7. $loc=$_REQUEST['offer_loc'];
  8. $path=$_FILES['offer_image']['name'];
  9. move_uploaded_file($_FILES['offer_image']['tmp_name'], "../graphics/" . $_FILES['offer_image']['name']);
  10.  
  11.  
  12. $qry="insert into special_offers(location,offer_image) values('$loc', '$path')";
  13.  
  14. if(mysql_query($qry))
  15. $msg="Offer Inserted successfully";
  16. else
  17. $msg="Error Inserting Offer";
  18. }
  19.  
  20. ?>
  21.  
vineet
Dec 18 '08 #1
Share this Question
Share on Google+
6 Replies


Markus
Expert 5K+
P: 6,050
Make sure the folder you're moving to file to has the correct permissions.
Dec 18 '08 #2

P: 41
@Markus

hi markus

how do i set corect permission. can u say in detail

vineet
Dec 18 '08 #3

Markus
Expert 5K+
P: 6,050
@vinpkl
Do you use an FTP for your site files - if so, what FTP program, or are they stored locally on your computer?

If they're stored on your computer, you can right-click a folder or file, select properties, and then, from the security tab, change it's permissions. - This is for Windows.

My FTP allows me to do the same thing; right-click the folder/file I want to edit, then change the permissions from their.
Dec 18 '08 #4

P: 41
@Markus

hi marcus

i m using ftp software.

tell me what to write in permission after right click properties. at present its 755

vineet
Dec 18 '08 #5

Markus
Expert 5K+
P: 6,050
@vinpkl
Try changing it to 766.
Dec 18 '08 #6

P: 41
@Markus

hi markus

just a question in my mind that

will changing permission harm my server or website security in any way.

vineet
Dec 18 '08 #7

Post your reply

Sign in to post your reply or Sign up for a free account.