Search code examples
c#asp.net-mvc-4jquery-file-upload

How to change upload folder dynamicly


I'm using Backload file upload controller in my CustomerPortal build with MVC4. Within the CustomerPortal you can add SupportCalls. Within the SupportCall you can attach files. Every SupportCall has its own Guid.

The web.backload.default.config file contains the default upload location of the file "~/Files". However I want the file location to be different for every SupportCall. Like: "~/Files/d764578d-2f13-4820-bf1f-3d4427aedf22" where the Guid differs every time.

How can I achieve that?


Solution

  • I found the answer to my question here : https://github.com/blackcity/Backload/wiki/Example-06

    <form id="fileupload" 
          action="/Backload/UploadHandler" 
          method="POST" 
          enctype="multipart/form-data">
    
        <input type="hidden" 
               name="objectContext" 
               value="@Html.ViewBag.Id" />
    </form>`
    

    Just had to add a hidden field with the Id