Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Le Xuan Trung 10 posts 80 karma points
    Aug 09, 2015 @ 03:55
    Le Xuan Trung
    0

    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

  • Robert Foster 459 posts 1820 karma points MVP 2x admin c-trib
    Aug 09, 2015 @ 04:41
    Robert Foster
    0

    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

    /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:

    https://our.umbraco.org/documentation/Reference/Routing/WebApi/

  • Zonkzen 6 posts 62 karma points
    Aug 25, 2015 @ 19:40
    Zonkzen
    0

    Can you post proper links?

  • Robert Foster 459 posts 1820 karma points MVP 2x admin c-trib
    Aug 26, 2015 @ 01:32
    Robert Foster
    0

    Hi, What do you mean by proper links?

  • James Jackson-South 489 posts 1747 karma points c-trib
    Aug 26, 2015 @ 04:36
    James Jackson-South
    0

    Hey Robert,

    Zonkzen means that the links in your reply are pointing to the current page.

  • Robert Foster 459 posts 1820 karma points MVP 2x admin c-trib
    Aug 26, 2015 @ 05:03
    Robert Foster
    0

    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.

Please Sign in or register to post replies

Write your reply to:

Draft