asp.net mvc - mvc4 upload file I can not invoking MY action -


i made action , using html.beginform upload image file
controller name imagestaple
, that:

    using system; using system.io; using system.collections.generic; using system.data; using system.data.entity; using system.linq; using system.web; using system.web.mvc; using bootstrab1.models;  namespace bootstrab1.controllers {     public class imagestablecontroller : controller     {         private spadbentities db = new spadbentities();          //         // get: /images/          public actionresult index()         {             return view(db.c_images.tolist());         }          [httppost]         public actionresult uploadimg(httppostedfilebase image)         {             if (image.contentlength > 0)             {                 var filefame = path.getfilename(image.filename);                 var path = path.combine(server.mappath("~/images/"), filefame);                 image.saveas(path);             }             return redirecttoaction("create");         }         //         // get: /images/details/          public actionresult details(int id = 0)         {             c_images c_images = db.c_images.find(id);             if (c_images == null)             {                 return httpnotfound();             }             return view(c_images);         }          //         // get: /images/create          public actionresult create()         {             return view();         }          //         // post: /images/create          [httppost]         [validateantiforgerytoken]         public actionresult create(c_images c_images)         {             if (modelstate.isvalid)             {                 db.c_images.add(c_images);                 db.savechanges();                 return redirecttoaction("index");             }              return view(c_images);         }          //         // get: /images/edit/5          public actionresult edit(int id = 0)         {             c_images c_images = db.c_images.find(id);             if (c_images == null)             {                 return httpnotfound();             }             return view(c_images);         }          //         // post: /images/edit/5          [httppost]         [validateantiforgerytoken]         public actionresult edit(c_images c_images)         {             if (modelstate.isvalid)             {                 db.entry(c_images).state = entitystate.modified;                 db.savechanges();                 return redirecttoaction("index");             }             return view(c_images);         }          //         // get: /images/delete/5          public actionresult delete(int id = 0)         {             c_images c_images = db.c_images.find(id);             if (c_images == null)             {                 return httpnotfound();             }             return view(c_images);         }          //         // post: /images/delete/5          [httppost, actionname("delete")]         [validateantiforgerytoken]         public actionresult deleteconfirmed(int id)         {             c_images c_images = db.c_images.find(id);             db.c_images.remove(c_images);             db.savechanges();             return redirecttoaction("index");         }          protected override void dispose(bool disposing)         {             db.dispose();             base.dispose(disposing);         }     } } 

my beginform that

@using (html.beginform("uploadimg","imagestaple", formmethod.post, new { enctype = "multipart/form-data" })) {   <table> <tr>     <td>file : </td>     <td><input type="file" name="file" id="file" /></td> </tr> <tr>      <td>&nbsp;</td>      <td><input type="submit" name="submet" value="upload" /></td> </tr>   </table>    } 

and action

 [httppost]         public actionresult uploadimg(httppostedfilebase image)         {             if (image.contentlength > 0)             {                 var filefame = path.getfilename(image.filename);                 var path = path.combine(server.mappath("~/images/"), filefame);                 image.saveas(path);             }             return redirecttoaction("create");         } 

now when press submet button
error mesage

server error in '/' application.  resource cannot found.  description: http 404. resource looking (or 1 of dependencies) have been removed, had name changed, or temporarily unavailable.  please review following url , make sure spelled correctly.   requested url: /imagestaple/uploadimg  version information: microsoft .net framework version:4.0.30319; asp.net version:4.6.1055.0 

what wrong in code plz thanx help

i misspelling, change imagestaple imagestable


Comments

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -