2

I have form that uploads file's perfectly, with a post-page-refresh-form.

However I have ajaxiefied the form with jquery's $.post

All of the data except for the file upload is saving nicely.

Is there somthing special I need to do to the form or in jquery to get the upload to work?

Thanks!

3 Answers 3

4

You cannot upload with javascript (it would mean granting js file access on your computer, a no go from security standpoint). Uploadify has a nice solution.

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

Comments

1

First off, I agree with Wrikken about Uloadify being a great solution.

But, yes, Javascript does not have access to upload files. There is a way around this by using Flash, but I would not go through all the trouble to build it yourself when there are other plugins out there that will take care of it all for you.

Comments

1

You can make it "lookalike" AJAX. Use a hidden iframe and send your form into this iframe, you will be able to observe the onload of the iframe and get a response.

This way gives you also the option for an easy fallback if JS is disabled.

3 Comments

We used to use this indeed back in the good ol' days, but an upload form to a hidden iframe may be non-javascript, it is not really user-friendly to let them upload stuff without any possibility to tell them that the upload failed, finished, whatever. That is what it would be like with no javascript (terrible confusing to users although it works).
You are wrong, it's very easy to leave anybody satisfied. Take a form and send this to _self-window(the NO-JS-way). With JS you only have to create the iframe and change the form's target-window to the iframe: anybody will be happy and able to get a response.
OK, I misunderstood / misread, I though you were claiming a hidden iframe as a non-js way, my apologies.

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.