This is a migrated thread and some comments may be shown as answers.

Async Upload Posting to Wrong Method

1 Answer 226 Views
Upload
This is a migrated thread and some comments may be shown as answers.
jim
Top achievements
Rank 1
jim asked on 31 Jul 2020, 11:04 PM

I am using .net core 3.5 and razor pages.   I have a file upload control that is calling OnPost even when the control explicitly says to call a different method name.

  @(Html.Kendo().Upload()
            .Name("files")
            .Multiple(false)
            .Async(a => a
                .Save("Async_Save", "New", new { Question = DebtorDropBox.Web.UI.Code.Question.DriversLicense })
                .AutoUpload(true)
            )
            .Events(e => e
                .Success("onSuccess")
                .Upload("onUpload")
                .Error("onError")
            )
            .Validation(validation => validation.AllowedExtensions(new string[] { ".jpg" }))
            .Validation(validation => validation.MaxFileSize(4000000))
        )

      for testing purposes I have added the following three methods to my page and no matter what It keeps calling OnPost.    Is there something I should be doing? 

        public async Task<ActionResult> Async_Save(IEnumerable<IFormFile> files, Question question)
        {
            return Page();
        }

        public async Task<ActionResult> OnPostAsync_Save(IEnumerable<IFormFile> files, Question question)
        {
            return Page();
        }

        public async Task<ActionResult> OnPost(IEnumerable<IFormFile> files, Question question)
        {
            return Page();
        }

1 Answer, 1 is accepted

Sort by
0
Martin
Telerik team
answered on 05 Aug 2020, 03:30 PM

Hello Jim,

Thank you for the provided code snippets.

Attached you will find a small project based demonstrating the Upload using both regular action methods and Page methods, which is currently commented out.

Let me know if you have any questions regarding the project. Feel free to modify it to demonstrate any issues you are experiencing.

Regards,
Martin
Progress Telerik

Tags
Upload
Asked by
jim
Top achievements
Rank 1
Answers by
Martin
Telerik team
Share this question
or