Just some ideas:
1. you can code your form always as multipart ... it just increases the data to transfer because of the MIME wrapping, but it does no harm.
2. I am quite sure that jQuery does not support serialize () on file fields, because the content of the file cannot be read into a variable by jQuery. Not to mention the memory load this could cause. Use some of the nice jQuery uploader scripts.
Thanks for the reply.
1. The form is encoded as multipart/form-data AND the function that submits the data is also enforcing enctype and encoding as multipart/form-data.
2. Plugins are not up to me, unfortunately. Can't download them, much less install them. The dev and production environments are super-tight.
I think I will need to find a way to have a hidden iframe upload the file(s) first, keep them in the VFS until the task is submit via AJaX, get the task ID and pass it to another script that will insert the files into the database, then delete them from the VFS.
Way more than I wanted to do, but I'm thinking it's my only option.
1 person found this helpful
Since you have the EDIT function working, maybe you can try and treat your ADD like an EDIT instead. What I mean is, have the ADD function first make an AJAX call to set/get the task ID that you need. Then process the rest of your info as an EDIT. Could that work?
Very high level I am thinking that you could make an AJAX call that would insert a subset of the information into your database, enough to get you a task ID and then return processing to your page. Now that you have a task ID you can process the rest of the information as you do for an EDIT (upload in an iframe).
Another possibility, yeah. That's more straight-forward than what I'm contemplating, now.
Thanks for the idea.
seems as I have misunderstood your problem.
As already suggested, you can use an sequence (INSERT on server, only minimum required fields, UPDATE on client data) instead of an INSERT on client data. Alternatively, you could give an ID which for sure does not exist and handle such a tastk id on the server via SQL or whatever you can use.