Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

405 Apache error on uploading file script

Status
Not open for further replies.

ariefk

Technical User
Mar 17, 2002
18
ID
Using the following script, I got "The requested method POST is not allowed for the URL /php/upload.html" response from Apache. Any suggestion to solve the problem ?

Regards,

Arief K

<HTML>
<HEAD>
<TITLE> Example Upload Form upload.phtml </TITLE>
</HEAD>
<BODY>
<?php
if ( $userfile )
{
@$res=copy($userfile,&quot;$userfile_name&quot;);
if ( !$res )
print &quot;Upload failed! \n&quot;;
else
print &quot;Upload of $userfile_name successful \n&quot;;
}
?>

<FORM method=POST ENCTYPE=&quot;multipart/form-data&quot;>
File to Upload
<INPUT TYPE=&quot;hidden&quot; name=&quot;MAX_FILE_SIZE&quot; value=&quot;5000000&quot;>
<INPUT NAME=&quot;userfile&quot; TYPE=&quot;file&quot; size=35>
<INPUT TYPE=&quot;submit&quot;>
</FORM>
</BODY>
</HTML>
 
You'll be pleased to know that this script works perfectly under windows and *nix for me.

- I had only one change to make for it to work with apache, The directory it sits in must have rwxrwxrwx permissions for this script to work and allow writing of the uploaded file.

chmod 777 your_dir_name
man chmod for more info of see the linux(server) boar. ***************************************
Party on, dudes!
 
It still doesn't work, I think it was something on apache setting, Any ideas ?
 
Only other thing worth a comment is that my file is read and executable -> needs the latter to be able to write I believe, chmod 755 $file
If this fails, try putting a file on the server with th ename of the file you want to write to and try changing the permissions until it works.

Like I say I created a file from your script above and it worked just fine for me. - possibly the access level that your httpd daemon is run on? ***************************************
Party on, dudes!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top