Skip to content

Not working when called from MVC areas #24

@dirkjanboeren

Description

@dirkjanboeren

First of all thanks for the effort, great library!

I've been working on a project which implemented MvcFileUploader, goal is to integrate the projects functionality into another, larger project that incorporates MVC Areas. The module wasn't working as expected and closer inspection led me to believe MVC Areas are not supported. I've so far only made a quick fix by updating GetUrlPostModel() in MvcFileUploadModelBuilder.cs to include an empty area parameter, in order for MVC routing to this module to work when called from within an area, as such:

private dynamic GetUrlPostModel()
        {
            return new 
            {
                FileTypes = _fileTypes,
                MaxFileSizeInBytes = _maxFileSizeInBytes,
                MaxNumberOfFiles=_maxNoOfFiles,
                DisableImagePreview=_disableImagePreview,
                UploadUrl = _uploadUrl,
                UIStyle = _uiStyle,
                ReturnUrl = _returnUrl ?? "#",
                RenderSharedScript = _includeScriptAndTemplate,                
                ShowPopUpClose = "link".Equals(_renderType) && _returnUrl != null,
                Area = ""
            };
        }

A better solution would ofcourse be to incorporate area support, e.g. by extending the IMvcFileUploadModelBuilder, are there any plans for that by any chance?

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