Problems setting up file download

Hello

I was wondering how to set up the download of files in the file explorer control.
The default action when selecting a file and clicking the download button results in a get request with the path and some other parameters, which is not really useful in my use case. In this demo (http://mvc.syncfusion.com/demos/web/fileexplorer/default) the download seems to work just fine (at least with images).

Could you please provide me with an example with the necessary changes to download a file (.xls, .pdf, etc.) as it can be done in the above demo ? 

Thank you for your help.


Kind regards
Phil

3 Replies

KR Karthik Ravichandran Syncfusion Team October 30, 2017 09:56 AM UTC

Hi Phil, 
 
Thanks for contacting syncfusion support. 
 
We have checked your query. We would like to inform you that, to read the PDF and XLS files, you need to add the file types in FileTypes API of FileExplorer and you can download these files as like other files. Please refer the below code block. 
 
@(Html.EJ().FileExplorer("fileExplorer") 
           .FileTypes("*.png, *.gif, *.jpg, *.jpeg, *.docx, *.pdf, *.xls") 
           .Path("~/content/images/FileExplorer/") 
           .AjaxAction(@Url.Content("/FileExplorer/FileActionDefault")) 
           .Width("900px").Height("400px").IsResponsive(true)) 
 
For your convenience we have attached the sample in the below link. 
 
 
To know more details, please refer the below documentation link. 
 
 
 
If we misunderstood your query, please let us know your exact requirement with more details. This will help us to provide the solution at earliest. 
 
Regards, 
Karthik R 



UN Unknown October 30, 2017 12:25 PM UTC

Hello

Thank you for your fast reply.

I tried adding the file types but that did not change anything for me.


However, I found my error. I had set a [HttpPost] attribute for the file explorer's ajax action. After removing it everything worked as expected.


Phil



KR Karthik Ravichandran Syncfusion Team October 31, 2017 07:22 AM UTC

Hi Phil, 
 
Most welcome. We are happy to hear that reported issue is solved in your side.  
 
Please let us know if you need further assistance on this. 
 
Regards, 
Karthik R 


Loader.
Up arrow icon