Skip to content

Problem using with PartialView #23

@SwartHack

Description

@SwartHack

Is there a sample for use with a partial view? I can't seem to get it to work round trip. Maybe I am just MVC dense but the upload view never gets the the controller response?! The file IS uploaded however!!! I have tried a number of different approaches: Action, RenderAction, RenderPartial, [ChildActionOnly]...and the result is always the same, the JSON response is just displayed in the browser (see attached), and the view never updates with status.
I can recreate the issue using the MvcTestUpload view and controller. If I alter demo.cshtml to be a partial and modify the controller accordingly, it results in the same behavior.

Demo.cshtml

@using MvcFileUploader.HtmlHelper
@using MvcFileUploader.Models
<div class="well">
    <legend>Upload Inline</legend>
    <p class="help-block">jpg/png size max 5 MB</p>
    @(
        Html.MvcFileUpload()
        .UploadAt(Url.Action("UploadFile"))
        .UIStyle(UploadUI.Bootstrap)
        .WithFileTypes(@"/(\.|\/)(jpe?g|png)$/i")
        .WithMaxFileSize(5000000)
        .AddFormField("entityId", "1234")
        .RenderInline("_MvcFileupload")
    )

</div>
public class MvcUploaderTestController : Controller
    {
        public ActionResult Demo()
        {
            return PartialView();
        }

        public ActionResult UploadFile(int? entityId) // optionally receive values specified with Html helper
        {            
            // here we can send in some extra info to be included with the delete url 
            var statuses = new List<ViewDataUploadFileResult>();
            .....

I have looked around and have not found a solution specific to this package. I could try to hack around the package scripts, but prefer to use this package "as-is". If you have any pointers or suggestions, they are greatly appreciated. Thanks, Eric

screen2
screen3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions