I looked but everything I have is too customized and proprietary to cut up. You simply need a form with an input of type file in it; set the action value to an ashx or aspx file that processes the file however you want using c# code like you listed. Then just call ajaxSubmit() on the form. Try a simple case, put a break in the C# page and you should see it working.
Hth, Dave On Sep 16, 4:39 pm, Kemps Almeida Vieira <[email protected]> wrote: > I tried to use JQuery Form Plugin, but I couldn't make it work on > JQuery UI Dialog... > > Do you have any idea to solve it? > Do you have any sample that use JQuery Form Plugin with JQuery UI > Dialog form? > > Tks! > > On Sep 16, 3:22 pm, Fontzter <[email protected]> wrote: > > > Hi, > > > This question is related more to jQuery in general and you would > > probably get more help on the main group list rather than this UI > > list. > > > However, I would recommend the form plugin which will allow you to > > submit the form:http://malsup.com/jquery/form/ > > > I do this all the time for uploads to an asp.net page (C#) and it > > works fine with code similar to yours using the form plugin. > > > Hth, > > > Dave > > > On Sep 16, 12:36 am, Kemps Almeida Vieira <[email protected]> > > wrote: > > > > Anybody knows how can I post a html <input type="file"/> by JQuery UI > > > Dialog? > > > > Is it possible to post a form "enctype="multipart/form-data" with a > > > "$.post()" method? > > > > I really appreciate to use this method because I can return a Json > > > result. It's very important for my Architecture.... > > > > Let me explain my app: > > > > I'm developing a ASP.Net MVC App and I'm using JQuery Dialog UI to > > > make a Rich Client app. Well, I have web page that I need to do a > > > FileUpload, but my code below doesn't working well... > > > > Anybody could help me, please? > > > > Html Code: > > > > <form action="" method="post" id="FormFileUpload" enctype="multipart/ > > > form-data"> > > > <input type="file" id="fileName" name="fileName" /> > > > </form> > > > > Jquery Code: > > > > $(".create").click(function(event) { > > > event.preventDefault(); > > > $("#dvForm").dialog('open'); > > > }) > > > > $("#dvForm").dialog({ > > > bgiframe: true, > > > autoOpen: false, > > > resizable: true, > > > modal: true, > > > height: 420, > > > width: 600, > > > buttons: { > > > 'OK': function() { > > > PostForm(); > > > }, > > > 'Cancelar': function() { > > > $(this).dialog('close') > > > } > > > } > > > }); > > > > function PostForm() { > > > // Set url Action and Controller asp.net MVC > > > var _urlAction = '<%= Url.Action > > > ("Create","FileUpload") %>'; > > > var _formData = $("form").serialize(); > > > $.post(_urlAction, _formData, PostFormReturn, > > > "json"); > > > } > > > > function PostFormReturn(json) { > > > if (json == true) { > > > alert("OK"); > > > } else { > > > alert("Err: " + json.ExceptionApp); > > > } > > > } > > > > C# Code: > > > > [AcceptVerbs(HttpVerbs.Post)] > > > public ActionResult Create(string fileName) > > > { > > > try > > > { > > > thisGetPostedFile(); > > > > return Json(true); > > > } > > > catch (Exception ex) > > > { > > > return Json(new { ExceptionApp = ex.Message }); > > > } > > > } > > > > private void GetPostedFile() > > > { > > > HttpPostedFileBase posted = Request.Files[0]; > > > if (posted.ContentLength > 0) > > > { > > > // Add media to file system > > > posted.SaveAs(HostingEnvironment.MapPath > > > (Path.GetFileName(posted.FileName)); > > > } > > > } --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "jQuery UI" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/jquery-ui?hl=en -~----------~----~----~----~------~----~------~--~---
