1

I am sending a file to my Java Servlet via jQuery Uploadify, there are no problems while sending the actual file. But when I try to send some scriptData with file along, to process on Servlet it just does not send anything.

Here is the JS code:

$("button").click(function(){
        $("#uploadify").uploadifySettings('scriptData', {'length':'0.2'});
        $('#uploadify').uploadifyUpload();
});

$('#uploadify').uploadify({
    'uploader': 'assets/uploadify/uploadify.swf',
    'script': 'upload',
    'folder': '/uploads'
});

And here is the Servlet code on the server side:

out.println(res.getParameter("length"));

Only output I get is null, while expecting "0.2". I just cannot get what's wrong and any kind of help will be appreciated.

Thanks in advance.

2 Answers 2

3

How do you handle uploaded file at the server side?

getParameter() doesn't work if you read the request body manually. You may use Commons FileUpload filter to read uploaded files and parameters simultaneously.

Sign up to request clarification or add additional context in comments.

2 Comments

Exactly, he needs to use the very same file upload API as well to grab the "plain vanilla" request parameters.
Thanks a lot, I used FileItem.getString instead and it works like charm now.
0

Try to use firebug to see what exactly is sent to a server. At the very least you'll see where error happens (in JS code or on serverside)

2 Comments

Well, I cannot see anything on the console being sent. But when I look at DOM > window > settings (settings of the uploadify), I can see settings I'd applied, but I cannot see scriptData setting. Any recommendations?
Well that's weird, if you see that nothing is sent in Firebug, still you see server output this means that firebug is not tracking network.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.