Delete file with Illegal Characters in Filemanager

Vote:
 

Greetings!

My customer accidentally managed to upload a file with illegal characters using the FileManager in EPiserver 7.1

This results in an yellow screen of death stating " System.ArgumentException: Illegal characters in path".

The error message also seems to give the id of the file.
 

What is the best way to remove this file and fix the error, making sure there are no left out paths/pointers in the database etc?

Bare in mind, I'm not really familiar with this environment since I've mostly worked with 7.5. 

Regards,

Christian

#148218
May 06, 2016 8:39
Vote:
 

If you are using 7.1 you need to use virtual path provider to programmatically work with files since contentrepository will only work with files from 7.5+. Try first to change the regex that validates files and see if that lets you delete it with file manager. Else do a scheduled job or similar that use virtual path provider and delete it programmatically. 

Check out 

http://world.episerver.com/documentation/Items/Developers-Guide/Episerver-CMS/7/File-System/How-To/Accessing-Files-and-Folders/

For how to work with these. It should be something similar to

    UnifiedFile file =
        System.Web.Hosting.HostingEnvironment.VirtualPathProvider.GetFile(path)
        as UnifiedFile;
    file.Delete();

...but I don't have a 7.1 environement up right now to check.

If you are using native provide type you can just delete the file. 

#148220
Edited, May 06, 2016 8:59
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.