AI OnAI Off
You can get a file info of newly created file like this:
private void Instance_CreatingContent(object sender, ContentEventArgs e) { var mediaData = e.Content as MediaData; if (mediaData != null) { var fileBlob = mediaData.BinaryData as FileBlob; if (fileBlob != null) { var fileInfo = new FileInfo(fileBlob.FilePath); // ... } } }
But I'm not sure you can get original file info...
"The magic" happens in EPiServer.Cms.Shell.UI.Controller.FileUploadController.
If you have dotPeek / ILSpy, you can take a look at UploadAssets and SaveFile methods.
Since uploaded file is posted as HttpPostedFileBase, and HttpPostedFileBase doesn't contain information such as creation date, creator name, etc. you cannot read metadata of original file.
Hello!
When upload files in Edit mode (using FileManager) I can't find any way to read metadata of original file (original file's created date, attributes, etc). What I tried was implementing ICreatingContent where I could get mediadata:
var mediaData = e.Content as MediaData;
but mediaData does not contain any info regarding metadata mentioned above.
Is there any way to read metadata of the actual file being uploaded?
Thanks in advance!