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

Auto Upload and RedirectToAction failed

1 Answer 215 Views
Upload
This is a migrated thread and some comments may be shown as answers.
K'Library
Top achievements
Rank 1
K'Library asked on 18 Dec 2018, 02:15 AM

Hi,

I use Telerik UI for ASP.NET Core Upload to upload an image to Azure storage, and it works.

I tried to use RedirectToAction to show the uploaded image in Details action, and the page keep stayed and didn't redirect. The codes are in PaperCognitionController, Index page for upload, and Details page to show image. 

 

I tried another action CharacterCognitionController Index to use RedirectToAction to test the redirect function, it worked but only the PaperCognitionController.SaveAsync didn't. 

 

Is there any problem with using Upload control?

And how to upload my code? The attachments cannot be zip file?

1 Answer, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 19 Dec 2018, 02:15 PM
Hi,

The RedirectToAction() method sends a 302 status code to the browser and redirects its URL. This means that it must happen in response to a request where the browser expects such a status code and will handle it as expected. An asynchronous request is not such a request and it will not follow redirects. The Upload widget uses asynchronous requests to upload files asynchronously.

If you want to show previews to the user, I suggest you use the success event to manipulate the DOM and construct an URL based on the file name and the known logic where the file is stored: https://docs.telerik.com/kendo-ui/api/javascript/ui/upload/events/success. You can see how to attach to them and a basic example of using the data in the following ASP.NET Core demo: https://demos.telerik.com/aspnet-core/upload/events.

On the attachments - in the forums only images are allowed and you can open a private support ticket where you can attach an archive with code, for example.


Regards,
Marin Bratanov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
Upload
Asked by
K'Library
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Share this question
or