Forums

File uploads with Ajax post?

Greg R. 01 May, 2014
Bob, I'm using an Ajax post on my latest form for a variety of reasons. Do you have a good method to process file uploads with an Ajax post? I know there are several examples out there, but let me know if you have done this before.
GreyHead 01 May, 2014
Hi Greg,

Sorry, I've never tried - Max may have some ideas.

Bob
Greg R. 01 May, 2014
I know Max is very busy, do you think he will see this post?
GreyHead 01 May, 2014
Hi Greg,

Probably, but you can make it more likely by sending him a message through the Contact Us menu and linking to this thread.

Bob
Greg R. 14 May, 2014
Bob, I'm having some challenges with this one, and I hope you can help me out. I've created a web app using jquery mobile for phone use. The purpose of the app is for users to fill out a form, and send their location information and photos, along with some other standard text fields. In order to preserve the seamless look of the app, I want to avoid an HTML post, as that would redirect them outside of the app's file structure to my website. Let me know if there is a way around the redirect altogether, As far as I know, that is only achievable with Ajax. I have the ajax post working just fine for all the field data, but as you know, file uploads are a challenge. I tried the method shown here, but I could never get it to send the file information in a way that Chronoforms would accept. The post url would look something like this: "htp://mywebsite.com?chronoform=myform&event=submit&files". Max and I went back and forth on it for a few emails, but he wasn't able to shed much light on the situation. The other challenge is validation. It's one form displayed on multiple pages, and some pages need to validate before going to the next page. If I can achieve all of this without Ajax, let me know.
Greg R. 14 May, 2014
Answer
Fortunately, I was able to discover a method that can successfully post both field info and files to a Chronoform. As it sits, it requires some modification, but if you understand what you're looking at, this does work:
http://new-bamboo.co.uk/blog/2012/01/10/ridiculously-simple-ajax-uploads-with-formdata
This topic is locked and no more replies can be posted.