Help me interpret/remedy Warning please

Discussion in 'PHP' started by chrisj, Aug 23, 2007.

  1. #1
    Thanks for looking at this post. How can I correct these Warnings?
    Your help will be greatly appreciated. Thanks.

    Warning: move_uploaded_file(C:/Documents and Settings/Featured.doc) [function.move-uploaded-file]: failed to open stream: Permission denied in C:\Inetpub\vhosts\httpdocs\uploads.php on line 105

    Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move 'C:\WINDOWS\Temp\php10.tmp' to 'C:/Documents and Settings/Featured.doc' in C:\Inetpub\vhosts\httpdocs\uploads.php on line 105

    Warning: chmod() [function.chmod]: No such file or directory in C:\Inetpub\vhosts\httpdocs\uploads.php on line 106

    Warning: Cannot modify header information - headers already sent by (output started at C:\Inetpub\vhosts\httpdocs\uploads.php:105) in C:\Inetpub\vhosts\httpdocs\uploads.php on line 69

    Line 105 is:
    $result = move_uploaded_file($temporary, $file_path);
    Code (markup):
    Line 106 through Line 109 are:
    if(!chmod($file_path,0777))
    	$message = "ERROR: A folder to place the files was not found, or the files need to be CHMODed to 777.";
    	else $message = ($result)?"File has been uploaded." : "An error has occurred.";
    	return $message;
    Code (markup):
    Line 69 is:
    header("Location: $site_uri?message=$message");
     
    chrisj, Aug 23, 2007 IP
  2. ssanders82

    ssanders82 Peon

    Messages:
    77
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Looks like you don't have write permissions on the folder you're trying to move the file to ("C:/Documents and Settings/") Maybe it's set to readonly? I've only dealt with this in Linux, which you just change permissions to 777.
     
    ssanders82, Aug 23, 2007 IP
  3. Colbyt

    Colbyt Notable Member

    Messages:
    3,224
    Likes Received:
    185
    Best Answers:
    0
    Trophy Points:
    210
    #3
    I agree with the "you don't have permission part".

    Try the 777 to see if it works and then see if you can back it down to a safer 766 or 755.

    777 can subject you to some potential hack problems.
     
    Colbyt, Aug 23, 2007 IP