2

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?

Martin
  • 141
  • 10

2 Answers2

4

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

Nate-Wilkins
  • 5,364
  • 4
  • 46
  • 61
Martin
  • 141
  • 10
  • I'm trying to follow in your footsteps and retrieve files only from the user's designated subfolder (as helgans describes below). I can't figure out how to set the objectContext on the GET request. How did you solve that? – cdutcher Aug 04 '14 at 03:39
2

You're correct, objectContext is used for this purpose. One remark, you can set the objectContext client side as you do or server side within an event (e.g. IncomingRequest) or an extension. If you want to retrieve files (GET request) for a specific user, make sure to send the objectContext with the request too (url or form) or set it server side.

helgans
  • 343
  • 2
  • 7