asp.net mvc - How to implement a second HttpPost in MVC C# -


from wp8 app have button sends file mvc wcf service. problem want have button sends file service, different second file. example, here want mvc like:

[httppost]     public actionresult index()   {      foreach (string upload in request.files)       {         //do upload     } }  [httppost]     public actionresult index()   {       foreach (string upload in request.files)       {         //do second upload     } } 

i can't seem figure how mvc can differentiate between 2 files uploaded separately. how know actionresult uploaded file go into? need added in order guide uploaded file intended actionresult?

this sends file wp8 app:

    private async void uploadfile()     {         //byte[] picbyte = photostream.toarray();         //photostream.read(picbyte, 0, system.convert.toint32(photostream.length));         //photostream.close();          //string connstr = @"data source=.\sqlexpress; initial catalog=imagedb; persist security info=true;user id=sa";         //sqlconnection conn = new sqlconnection(connstr);                  try                        {                                // make sure there picture selected                                if (photostream != null)                              {                                        // initialize client                                    // need make sure server accepts network ip-based                               // requests.                                     // ensure correct ip , correct port address                                    var fileuploadurl = @"http://localhost:54931/fileupload";                                     var client = new httpclient();                                      // reset photostream position                                    // if don't reset position, content lenght                                     // sent 0                                    photostream.position = 0;                                     // postdata                                    multipartformdatacontent content = new multipartformdatacontent();                                 content.add(new streamcontent(photostream), "file", filename);                                    // upload file sending form info , ensure result.                                  // throw exception if service doesn't return                                    // valid successful status code                                    await client.postasync(fileuploadurl, content)                                         .continuewith((posttask) =>                                              {                                                 posttask.result.ensuresuccessstatuscode();                                     });                             }                               // disable upload button                             btnupload.isenabled = false;                              // reset image control                                imgselectedimage.source = null;                              // display uploaded message                            txtmessage.visibility = visibility.visible;                      }                      catch                        {                                // display uploaded message                           txterror.visibility = visibility.visible;                     }       } 

if doing different things files, name action differently, can upload file different urls, index() it'll /, , other dosomethingelse() it'll /dosomethingelse


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -