Page 1 of 2

Apache configurations for HTTP PUT

Posted: Wed Oct 28, 2009 9:27 am
by jmaster
Hello.

While trying out the resume feature using HTTP PUT (via process.php), the upload process indicator went up 100% but came short with the error "Server error HTTP/1.1 403 Forbidden" on the applet window. No files appeared in the /upload folder. Using HTTP POST worked flawlessly (although resume not possible).

I have got all the PARAMS correct (httpmethod is PUT) as in applet_http_resume.js and the correct configurations in process.php, so I suspect its in the webserver configuration. Apache by default has the PUT method disabled??

I have tried .htaccess with only "SCRIPT PUT /process.php" and put that .htaccess in a subfolder in the server. The following error appeared:

"Internal Server Error - The server encountered an internal error or misconfiguration and was unable to complete your request. etc etc".

I'm sure i missed something. Can someone help with a simple configuration file (eg: .htaccess) where i can just put it in a subfolder where all the files are.

Thanks for the help.

Re: Apache configurations for HTTP PUT

Posted: Wed Oct 28, 2009 5:43 pm
by support
403 means forbidden. So the PUT request is not allowed. Do you have Apache 1 or Apache 2?
The HTTP PUT will be handled by PHP so you should also check that your PHP configuration allows HTTP PUT.

Re: Apache configurations for HTTP PUT

Posted: Thu Oct 29, 2009 1:19 am
by jmaster
Hello. Thanks for the reply.

The server I use is Apache 2.2.x, with PHP 5.x running. It is also a shared hosting.

Is there anywhere to check if the default PHP configuration supports PUT and if not, any settings to enable it (eg: maybe in .htaccess or httpd.conf, etc)?

Thanks for the help.

Re: Apache configurations for HTTP PUT

Posted: Thu Oct 29, 2009 6:57 am
by jmaster
Hello.

I've got the HTTP PUT to work. Add the following to the .htaccess.

<Limit PUT DELETE>
order deny,allow
allow from all
</Limit>

Naturally this will post security risks, but at least the PUT method works now. :P

Got another question, which is on uploading. When you upload individual files, you are able to use the "overwrite=false", and attempting to reupload the same files will result in nice warning on the applet window. However, when you upload a folder (or subfolders) with the same individual files inside, the overwrite=false doesn't seem to work but overwrite the entire same files again, eventhough they have been uploaded once.

Fixing this will be on the server side scripting? Or need to tweak the applet params for this?

Thanks again.

Re: Apache configurations for HTTP PUT

Posted: Thu Oct 29, 2009 7:27 am
by support
Mmhh, no it should work too even with file in subfolder. Could you post your JavaScript here?
Are you using:
<PARAM NAME="param4" VALUE="relativefilename">
<PARAM NAME="value4" VALUE="true">
<PARAM NAME="folderdepth" VALUE="-1">

Re: Apache configurations for HTTP PUT

Posted: Thu Oct 29, 2009 8:34 am
by jmaster
Hello. Thanks for the quick reply.

These are the current PARAM settings i use.

document.writeln('<PARAM NAME="paramfile" VALUE="uploadfile">');
document.writeln('<PARAM NAME="param1" VALUE="todo">');
document.writeln('<PARAM NAME="value1" VALUE="upload">');
document.writeln('<PARAM NAME="param2" VALUE="errorheader">');
document.writeln('<PARAM NAME="value2" VALUE="custommessage">');
document.writeln('<PARAM NAME="param3" VALUE="relativefilename">');
document.writeln('<PARAM NAME="value3" VALUE="true">');
document.writeln('<PARAM NAME="param4" VALUE="httpmethod">');
document.writeln('<PARAM NAME="value4" VALUE="PUT">');
document.writeln('<PARAM NAME="resume" VALUE="true">');
document.writeln('<PARAM NAME="overwrite" VALUE="false">');
document.writeln('<PARAM NAME="folderdepth" VALUE="-1">');
document.writeln('<PARAM NAME="mode" VALUE="http">');
document.writeln('<PARAM NAME="resources" VALUE="i18n">');

and for NS:

document.write('paramfile="uploadfile" ');
document.write('param1="todo" ');
document.write('value1="upload" ');
document.write('param2="errorheader" ');
document.write('value2="custommessage" ');
document.write('param3="relativefilename" ');
document.write('value3="true" ');
document.write('param4="httpmethod" ');
document.write('value4="PUT" ');
document.write('resume="true" ');
document.write('overwrite="false" ');
document.write('folderdepth="-1" ');
document.write('mode="http" ');
document.write('resources="i18n" ');
document.write('scriptable=true ');



Currently, for example, if i upload a folder (eg: folder1/) that has 2 more folders in it, like folder1/folder2 and folder1/folder3, the structures of the uploaded folders in the server will look like this:

/folder1/
/folder1_folder2/
/folder1_folder3/

.. instead of retaining the original folders tree.

Thanks again.

Re: Apache configurations for HTTP PUT

Posted: Thu Oct 29, 2009 12:55 pm
by jmaster
Just tested uploading multiple folders using different browsers, other than Firefox. It appears that in IE, the folder structures are retained perfectly. But not in Firefox. I wonder why.

Re: Apache configurations for HTTP PUT

Posted: Thu Oct 29, 2009 6:33 pm
by support
Using "template" parameter could be an explanation but you're not using it, correct ?
Please try to clean both browser and Java cache:
Start->Control panel->Java->First tab->Delete temporary folders.

Re: Apache configurations for HTTP PUT

Posted: Fri Oct 30, 2009 7:30 am
by jmaster
Hello.

Yes, no "template" was used.

I just tried again to upload multiple folders with IE, and its the same with Firefox, where the folders became jumbled up in the server.

Could it be how "process.php" handles the naming of the files / folders?

Thanks.

Re: Apache configurations for HTTP PUT

Posted: Fri Oct 30, 2009 5:50 pm
by support
Could you provide a testing URL so I could check what's wrong ?
I would also need an access to the server to see the folder.

If so you can send info to support(at)jfileupload(dot)com