Connecting Tech Pros Worldwide Forums | Help | Site Map

Problem with uploading image

Member
 
Join Date: May 2008
Posts: 118
#1: Mar 26 '09
Hi,

i wrote a code to upload a image.In my local it works fine. When i place this code in website through FTP. In that it will not works.
i am giving the upload path ../upload . When i try to give the chmod permissions in FTP through fileattributes propery to upload folder it will give the message as

Status: Set permissions of '/admin/upload' to '777'
Command: SITE CHMOD 777 upload
Response: 500 'SITE CHMOD 777 upload': command not understood

code :

Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  5. <title>Untitled Document</title>
  6. </head>
  7.  
  8. <body>
  9. <form name="Form1" method="post" action="test_add_act.php" enctype="multipart/form-data">
  10. <input type="hidden" name="chk[]" value="">
  11. Image<input type="file" name="upload" />
  12. <br /><input type="submit" name="submit" value="Submit" />
  13. </form>
  14. </body>
  15. </html>
  16.  
  17.  
test_add_act.php

Expand|Select|Wrap|Line Numbers
  1. <?
  2. $filen=$_FILES['upload']['name'];
  3. $path = '../upload/'.$filen; //generate the destination path
  4. $imagepath='upload/'.$filen;
  5. move_uploaded_file($_FILES["upload"]['tmp_name'],$path);
  6. ?>
  7.  
i am getting this error

Warning: move_uploaded_file(../upload/admin_02.gif) [function.move-uploaded-file]: failed to open stream: Permission denied in C:\Inetpub\vhosts\bodypost.com\httpdocs\admin\test _add_act.php on line 14

Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move 'C:\WINDOWS\Temp\php21.tmp' to '../upload/admin_02.gif' in C:\Inetpub\vhosts\bodypost.com\httpdocs\admin\test _add_act.php on line 14


Anybody Could please tell the solution how can i resolved my problem?

Member
 
Join Date: Feb 2008
Location: chennai
Posts: 35
#2: Mar 26 '09

re: Problem with uploading image


Hi swethak ,

check ur folder have all rights that is read,write and execute.
Dormilich's Avatar
Moderator
 
Join Date: Aug 2008
Location: Leipzig, Germany
Posts: 3,660
#3: Mar 26 '09

re: Problem with uploading image


Quote:

Originally Posted by swethak View Post

Status: Set permissions of '/admin/upload' to '777'
Command: SITE CHMOD 777 upload
Response: 500 'SITE CHMOD 777 upload': command not understood

it seems like your server didn't understand your chmod command and thus didn't set the permissions you wanted. the response looks like an "internal server error".
Reply