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

Any thoughts on handling users who insist on using & in the filename which results in a Bad Request error in FileExplorer?

5 Answers 70 Views
FileExplorer
This is a migrated thread and some comments may be shown as answers.
Karl Wilkens
Top achievements
Rank 1
Karl Wilkens asked on 10 Apr 2013, 04:47 PM
Hi,

We have users who are fond of uploading files named like this - 

CMSC_MANAGING SPEECH & SWALLOWING IN MS.PDF

The ampersand kills any ability to download the file and we get a Bad Request error. Is there any flag in the file explorer that would handle this scenario and encode the names and allow download without error? Thanks.

5 Answers, 1 is accepted

Sort by
0
Vessy
Telerik team
answered on 15 Apr 2013, 01:34 PM
Hi Karl,

This is an expected behavior because the "%" sign is one of the reserved symbols and I would recommend you to use one of the following approaches:
  • check whether the user is trying to upload a file, containing a restricted symbol and cancel the upload in such case. More information is available here - How to notify the user that an image with invalid file name is being uploaded .For your convenience I am attaching a sample project, including also the way to achieve it with enabled AsyncUpload.
  • check whether the user is trying to upload a file, by overriding the default FileSystemContentProvider's StoreMethod() and directly replace the undesired symbols in the fileName. For example:
    public override string StoreFile(Telerik.Web.UI.UploadedFile file, string path, string name, params string[] arguments)
    {
        name = name.Replace('%', '_');
        return base.StoreFile(file, path, name, arguments);
    }

I hope this information would be helpful for you.

Regards,
Veselina Raykova
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
swapnil
Top achievements
Rank 1
Iron
answered on 06 Feb 2019, 06:03 PM

I have one question on same

I am overriding below method of Telerik (FileBrowser Content Provider) to deal with Saving File on disk and Object Storage AWS

public override string StoreFile(UploadedFile file, string path, string name, params string[] arguments){return base.StoreFile(file, path, name, arguments);

The path paramater of StoreFile works fine in case of file saving to disk but in case of Object Storage AWS it does not. Scenario - if path is like '/Object/Stack OverFlow'/ it works fine for disk but for object storage it gives same path as '/Object' , it ignores folder with (Space, Special characters etc.)

How to get this complete path in case of Object Storage AWS ?

0
Vessy
Telerik team
answered on 08 Feb 2019, 12:01 PM
Hi swapnil,

Such behavior is usually faced when the control cannot find the full path that is passed. In order to make the control work with a different storage location (than virtual paths), you have to implement a full FileBrowserContentProvider, overriding all of its methods:
https://docs.telerik.com/devtools/aspnet-ajax/controls/fileexplorer/server-side-programming/use-custom-filebrowsercontentprovider

You can use the provided by us DB provider as a base in case you do not have such implementation and examine the paths handling in it:
https://www.telerik.com/support/code-library/connect-radfileexplorer-or-radeditor-to-a-sql-databse

Regards,
Vessy
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.
0
swapnil
Top achievements
Rank 1
Iron
answered on 08 Feb 2019, 02:57 PM

Hi Vessy,

I am overriding all the methods as described in below post, the only problem come in case of folder path having special characters and spaces.

Example -  /Telerik/Hello World , / Telerik/ DT$Search , this path comes as /Telerik , /Telerik 

StoreFile() , path parameter does not give full path

If path is like /Telerik/HelloWorld it works perfectly.

 

https://docs.telerik.com/devtools/aspnet-ajax/controls/fileexplorer/server-side-programming/use-custom-filebrowsercontentprovider

 

 

0
Vessy
Telerik team
answered on 13 Feb 2019, 12:08 PM
Hi swapnil,

I tested the described scenario with the content provider from this KB article and all path were received properly in the StoreFile() method. Can you, please, compare the implementation of the provider from this article with your actual one and see how they differ?

You can see a video from my test here:
https://www.screencast.com/t/5ZgjKAyk3T

Meanwhile, I will also advise that you review the following help article and see if any of the described limitations is not causing the problem at your end:
https://docs.telerik.com/devtools/aspnet-ajax/controls/fileexplorer/troubleshooting/restricted-symbols

Regards,
Vessy
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
FileExplorer
Asked by
Karl Wilkens
Top achievements
Rank 1
Answers by
Vessy
Telerik team
swapnil
Top achievements
Rank 1
Iron
Share this question
or