We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Uploadbox post sometimes missing controller name?

I have a simple Uploadbox in an MVC 5 page which sometimes correctly posts to the controller’s upload method (/SyncFusion/Upload) but at seemingly random times it posts without the controller name, so it ends up at a location that does not exist (/Upload). Of course I tried adding the controller name into the SaveUrl but it breaks again when next the Uploadbox begins including the controller name. Any suggestions?


Here is the Uploadbox in question.


@{
    var uploadBoxProperties = new UploadboxProperties {
        AsyncUpload = true,
        SaveUrl = "Upload",
        MultipleFilesSelection = true,
        ShowFileDetails = true,
        UploadBoxButtonText = new UploadboxButtonText {
            Browse = "Add Files",
        }
    };
    @Html.EJ().Uploadbox("postedFiles", uploadBoxProperties)
}


Attachment: Razor_f7ae1ed7.zip

3 Replies

SN Sasikala Nagarajan Syncfusion Team December 19, 2014 11:32 AM UTC

Hi Matthew,

Thanks for using Syncfusion products

We have analyzed your given query “Location that does not exist (/Upload)” and we suspect that the cause of the issue may be mismatch of URL. If we run the sample at “http://localhost:XXXX/” location, and try to upload a file from this path, it’s try to search for “upload” a method in http://localhost:XXXX/upload which one is does not exists. So its returns the “404 not found” error.

So please run the sample from URL (“http://localhost:XXXX/Home/Index”) with controller name and view page specified. Or else provide the SaveUrl as “<Controller-name> /action name” (for example “/Home/upload”).

Please find the below code snippet

[_cshtml]

@{

        var uploadBoxProperties = new UploadboxProperties

                {

                    AsyncUpload=true,

                    SaveUrl = "/Home/upload",

                    MultipleFilesSelection = true,

                    ShowFileDetails = true,

                    UploadBoxButtonText = new UploadboxButtonText

                    {

                        Browse = "Add Files",

                    }

                };

                }

    @Html.EJ().Uploadbox("postedFiles", uploadBoxProperties)

 

Upload method works fine in both URL (http://localhost:XXXX/Home/Index, http://localhost:XXXX/) when we specify the SaveUrl with Controller name (“SaveUrl = "/Home/upload",).

Also, we need to clarify that whether the given response meets your requirement or we misunderstood, if so could please provide more details about the requirement and it will be easy for us to provide the exact solution.

Please let us know if you need any further assistance,

Regards,

Sasikala Nagarajan



MC Matthew Cestarte December 22, 2014 06:15 PM UTC

Thank you, Sasikala.  It is working.

Previously in my attempts which yielded different results (like posting to /SyncFusion/SyncFusion/Upload), I must have missed the beginning '/' so my SaveUrl was "SyncFusion/Upload" instead of "/SyncFusion/Upload".


SN Sasikala Nagarajan Syncfusion Team December 23, 2014 10:04 AM UTC

Hi Matthew Cestarte,

Thanks for the update,

Please let us know if you need any further assistance,

Regards,
Sasikala Nagarajan


Loader.
Live Chat Icon For mobile
Up arrow icon