Dear all I want a small piece of help. I have designed a PHP form to upload a file and some other text fields. How can I initiate background uploads even before the form is uploaded
Without the user knowing it? Unless you do something tricky with Javascript and iFrames, you can't. But explain a bit better what exactly you're trying to do.
I want that as the user is filling the forms, the data be transfered to the database and the file selected for upload should also start uploading before the user clicks the SUBMIT button. Yes, the upload should not be in the knowledge of the user. The only reason for this is that the users can submit more number of files in a limited amount of time.
Make a separate form for each file and put each in an iframe, then use the onchange attribute to make the form submit when the user selects a file.
How does GMail do it? When I add an attachment in Gmail, if I sit there without submitting the form, it uploads the file automatically. I assumed it was an AJAX call to force form.submit(), but nico you're saying AJAX doesn't support file uploading?
It's a tricky method with iframes probably. There is no way to upload a file with AJAX. Search a bit around if you want, you'll see they're all using tricky methods, but none uses AJAX alone.
i have studied Gmails code with alot of effort cause of obfuscation , turns out they ARE actually using iframes. And yes AJAX doesnt support file uploads. (thanks God)
oh srry my error ... just started learning AJAX... yeah iframe is very useful!! was using iframe tricks when i wasn't aware there was AJAX
Can someone please help me with a sample code? I am new to web development and dont know much about this kind of stuff. Thanks in advance.