Hmm. I am creating hidden form elements and i am inserting returned result to that element. Here is sample cod:
function ajaxFileUpload() { $.ajaxFileUpload ( { url:base_modal+'c=content&m=uploadFile', secureuri:false, fileElementId:'fileToUpload', dataType: 'json', success: function (data, status) { if(typeof(data.error) != 'undefined') { if(data.error != '') { // we got a problem alert(data.error); } else { // upload ok // returned result {filename:'zzzz.yyy', ext:'yyy', uid:'md5_session_path'} alert("your file uploaded!"); add_to_uploads(data.filename, data.ext, data.uid); } } }, error: function (data, status, e) {// hmmm alert(e); } } ); } // add hidden form element function add_to_uploads(filename, ext, uid) { var elem = '<li id="file_' + uid + '"><input type="hidden" name="uploaded_file" value="' + uid + '" /></li>'; $('#uploaded_file_list').append(elem); } I am also saving uploded file in session. When i post to form, just checking hidden file elements and session uploaded files. If there any element matching, i am insterting to record database, this way i can upload more than one file just a form. 2008/2/22, hcvitto <[EMAIL PROTECTED]>: > > > hi Yılmaz > thanks for the reply.. > I followed your (good) advice with some change. This is what i did: > > 1- deleted the url:' option from ajaxFileUpload function, so my php > file is called rightly once; > 2- when i call the jquery $.ajax function i clone the input created > from the $.ajaxFileUpload into my form > 3- all my data are sent to the php script > > and that's perfect but..using jquery apparently i cannot specify that > i have a $_FILES['myInputFile'] into the data option (If i get as > $_POST it's ok). > I specified processData as false between the $.ajax optoin but with > no use. > > any idea why? > Vitto > > > > deleted > > > On Feb 21, 10:39 am, "Yılmaz Uğurlu" <[EMAIL PROTECTED]> wrote: > > I am using this plugin just like that. > > <form ...> > > > > ... my other form elements > > > > <p> > > <label for="fileToUpload">Choose File :</label> > > <input id="fileToUpload" type="file" name="fileToUpload" /> > > <input type="button" id="upload_btn" value="Upload!" > > onclick="ajaxFileUpload();" /> > > </p> > > > > ... other elements, my form is huge :) > > </form> > > > > ajaxFileUpload() does not need to be posting your form. It's already > > creating iframe and posting file over this element. So, you can use like > > this, i am using with no problem. > > > > > 2008/2/20, hcvitto <[EMAIL PROTECTED]>: > > > > > > > > > > > > > > hi > > > i'm using the ajaxfileupload plugin from this site > > >http://www.phpletter.com/Our-Projects/AjaxFileUpload/(which works > > > great) in a form with different kind of input file. The form is > > > "ajaxed" through the $.ajax jquery function. Following the form > > > submitting is a mail with the data from the form. > > > > > Problem: i use the '$.ajax' and the '$.ajaxFileUpload' on the same > > > form which calls for the same php file, which is now called twice, > > > once per function. So everytime i submit the form two mails are sent, > > > one with the data the other with the file attached. > > > > > How can i integrate the ajaxfileupload in my form? anyone does know > > > this plugin? > > > > > Thanks Vitto > > > > > this is my form submit ajax function: > > > > > $.ajax({ > > > type: "POST", > > > url: "curriculumInvio.php", > > > data: myData, > > > success: function(){ > > > myFunction > > > } > > > }); > > > > > this is the plugin ajax function: > > > > > $.ajaxFileUpload({ > > > url:'curriculumInvio.php', > > > secureuri:false, > > > fileElementId:'fileToUpload', > > > dataType: 'json', > > > success: function (data, status){ > > > plugin stuff, > > > } > > > }); > > > > -- > > > Yılmaz Uğurlu ~ jabber : [EMAIL PROTECTED] ~http://www.2nci.com~ > İzmir > -- Yılmaz Uğurlu ~ jabber : [EMAIL PROTECTED] ~ http://www.2nci.com ~ İzmir