MvcFileUploader icon indicating copy to clipboard operation
MvcFileUploader copied to clipboard

Not working when called from MVC areas

Open dirkjanboeren opened this issue 7 years ago • 0 comments

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?

dirkjanboeren avatar Mar 12 '18 14:03 dirkjanboeren