i have used @using (Html.BeginForm("UploadAnh", "/umbraco/api/SignUp", FormMethod.Post, new {enctype = "multipart/form-data"})) to pass file from view to controller. But in controller i inherit from umbracoapicontroller, so wrong path. I need help form every one. thanks
However I've just re-read your post and noticed that you're trying to post back to an UmbracoApiController - this is essentially a standard ApiController with Umbraco bits and routing bolted on, so I'd just use standard jQuery Ajax.post functionality.
Your route, if you haven't specified a plugin attribute will be
/Umbraco/api/signup/uploadanh
Assuming your controller is signup and your method is UploadAnh.
Does this help? More information on the WebApi implementation can be found here:
Aha! I think I know what happened - I actually created that post on my phone, and browsing around for the links (which it appears have changed now with the recent updates to Docs anyway) cut'n'paste somehow got confused.
Have edited the original post and it should have the correct links to documentation for the current way of doing things.
Pass data from view to controller using beginform
i have used @using (Html.BeginForm("UploadAnh", "/umbraco/api/SignUp", FormMethod.Post, new {enctype = "multipart/form-data"})) to pass file from view to controller. But in controller i inherit from umbracoapicontroller, so wrong path. I need help form every one. thanks
Hi, you need to use Umbraco.BeginUmbracoForm() instead of Html.BeginForm() with SurfaceControllers:
https://our.umbraco.org/Documentation/Reference/Templating/Mvc/forms
However I've just re-read your post and noticed that you're trying to post back to an UmbracoApiController - this is essentially a standard ApiController with Umbraco bits and routing bolted on, so I'd just use standard jQuery Ajax.post functionality.
Your route, if you haven't specified a plugin attribute will be
Assuming your controller is signup and your method is UploadAnh.
Does this help? More information on the WebApi implementation can be found here:
https://our.umbraco.org/documentation/Reference/Routing/WebApi/
Can you post proper links?
Hi, What do you mean by proper links?
Hey Robert,
Zonkzen means that the links in your reply are pointing to the current page.
Aha! I think I know what happened - I actually created that post on my phone, and browsing around for the links (which it appears have changed now with the recent updates to Docs anyway) cut'n'paste somehow got confused.
Have edited the original post and it should have the correct links to documentation for the current way of doing things.
is working on a reply...