Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

Delete/create or modify file in FileManager

Vote:
 

string filePath = "/Global/MyFolder/Image1.jpg";

How can I modify or delete/create that file programatically?

 

I tried using Virtual path but it's open functionality returns a read -only stream.

VirtualFile virtualFile = HostingEnvironment.VirtualPathProvider.GetFile(virtualPath);

 

There's a UnifiedDirectory.CreateFile(filename) but there's no UnifiedDirectory.DeleteFile(filename).

 

I'm still finding out how to delete/create or replace the file in File manager.

#52216
Jul 12, 2011 17:02
Vote:
 
UnifiedFile file = VirtualPathHandler.Instance.GetFile(filePath, true) as UnifiedFile;
stream = file.Open(FileMode.OpenOrCreate, FileAccess.ReadWrite);
#52217
Jul 12, 2011 17:11
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.