As I mentioned, I have no problem doing this using the ajaxSubmit of
the form plugin.  It works great and all other form values are posted
as well.  (Make sure you use a name attribute for your inputs.)  Try a
simple test case and put a break in your C# and you will see it.

Dave


On Sep 17, 9:55 am, diogobaeder <[email protected]> wrote:
> Kemps,
>
> $.post method uses XmlHttpRequest (or ActiveX when IE) under the hood
> to make asynchronous requests via HTTP POST method; This JavaScript
> class doesn't support file uploading, and it's not a jQuery problem,
> it's simply a language specification.
>
> But you can check out some plugin that does this - they're generally
> related to a file upload context -, like this one for 
> example:http://plugins.jquery.com/project/uploadify
> Just a catch: watch out for the users' Flash plugin, because some
> uploaders didn't work when the user updated to Flash 10.x.
>
> Regards,
>
> Diogo
>
> On Sep 17, 12:59 am, Kemps Almeida Vieira <[email protected]>
> wrote:
>
> > Hello Dave, I know this method, but in my dialog, I have others
> > informations that can be inserted by user, for example, I have
> > dropdown list (<select />),
> > name of image (<input type="text" />) and description (<textarea />).
>
> > I would just want to post my dialog Form by JQuery UI button 'OK' and
> > $.post() method, like below, it will be perfetc for my application,
> > because I could catch an exception and json result on client side....
>
> > for example:
> > <form action="" method="post" id="FormFileUpload" enctype="multipart/
> > form-data">
> >   <select id="">...
> >   <input type="text"/>...
> >    <textarea/>...
> >    <input type="file">
> > </form>
>
> > $("#FormFileUpload").dialog({
> >                   bgiframe: true,
> >                   autoOpen: false,
> >                   modal: true,
> >                   buttons: {
> >                       'OK': function() {
> >                            $.post(url, formData, function(json){
> >                               if (json == true)
> >                                  alert("successfuly");
> >                               else
> >                                  alert("Err: " + json.ErrorMessage);
> >                            }, "json");
> >                       },
> >                       'Cancel': function() {
> >                           $(this).dialog('close')
> >                       }
> >                   }
> >               });
>
> > On Sep 16, 6:02 pm, Fontzter <[email protected]> wrote:
>
> > > 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));
> > > > > >             }
> > > > > >         }- Hide quoted text -
>
> > > - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to