Process file is accessed twice

Upload core product.
Post Reply
dstonek
Posts: 52
Joined: Fri Mar 21, 2008 3:19 pm

Process file is accessed twice

Post by dstonek »

V2.0
I found that each time a file is uploaded the process file is accessed twice.
The first time no vars are posted. In my case it causes that Apache generates 4 error messages/upload. Have an idea when users upload hundreds of files...
The second time is the regular one.
Here are some parameters from applet_http.js:

Code: Select all

document.writeln('<PARAM NAME=NAME VALUE="fileupload">');
document.writeln('<PARAM NAME="scriptable" VALUE="true">');
document.writeln('<PARAM NAME="url" VALUE="http://domain.com/process-upload.php">');
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="mode" VALUE="http">');
document.writeln('<PARAM NAME="param7" VALUE="codigo">');
document.writeln('<PARAM NAME="value7" VALUE="DATA">'); 
document.writeln('<PARAM NAME="filter" VALUE="jfileupload.upload.client.filter.ImageFilter">');
How can this be solved?
Thank you

User avatar
support
Posts: 1503
Joined: Sun Jan 27, 2008 6:19 pm

Re: Process file is accessed twice

Post by support »

Are you using "resume" or "overwrite" parameter ? Because such parameter make the applet send a first request before upload.

dstonek
Posts: 52
Joined: Fri Mar 21, 2008 3:19 pm

Re: Process file is accessed twice

Post by dstonek »

document.writeln('<PARAM NAME="resume" VALUE="true">');
Is it possible to send a post var only within this first request?
If so, I can state an 'if', ask for it and skip the file process to avoid these error msgs.Thxs

User avatar
support
Posts: 1503
Joined: Sun Jan 27, 2008 6:19 pm

Re: Process file is accessed twice

Post by support »

No, because "post" follows a successful upload. So, upload need to be completed before sending post request. However, for "resume", the applet send a HTTP HEAD request, not POST so you could filter or test the HTTP method.

Does it help ?

dstonek
Posts: 52
Joined: Fri Mar 21, 2008 3:19 pm

Re: Process file is accessed twice

Post by dstonek »

Nice!
Thank you.

Code: Select all

if ($_SERVER['REQUEST_METHOD'] != 'HEAD'){
// process here
}

Post Reply