Topics: Core, Customizing Orchard, Writing modules
Feb 12, 2012 at 9:09 AM

The IMediaService allows us to upload files, but it doesn't seem to provide an option to overwrite existing files, nor does it seem to allow us to check if a certain file exists. I think this would make for a nice feature, unless there is already support for overwriting files that I am missing?

Feb 12, 2012 at 11:16 AM
Edited Feb 12, 2012 at 11:17 AM

The current implementation of IMediaService uses IStorageProvider that lacks this feature (I've implemented FileExists() and FolderExists() in a fork, but since this is an interface change, would break existing implementations; developers could be warned in advance, though) as well as there is a feature request for IMediaService too.

Feb 12, 2012 at 11:20 AM

Excellent, I just voted for both feature requests. I hope that your fork will be included in the main branch, as it would simplify uploading media for me. Right now, I'll just catch the exception whenever a file exists, remove the file, then try again.