Hi.
I am trying out the EPiServer File Events for a project I am working on. When a picture file is added, I want to use a third party component to genereate some extra files out of the originalfile that is added. I then need to know the lenght of the file, but the length of the originalfile is 0. Why is this?
I use the code below to get the UnifiedFile. Is this a wrong way to do it? Is there another way I can get the file and its size?
protected void UnifiedDirectory_UnifiedFileAdded(UnifiedDirectory sender, UnifiedVirtualPathEventArgs e)
{
UnifiedFile addedFile = HostingEnvironment.VirtualPathProvider.GetFile(e.NewVirtualPath) as UnifiedFile;
}
That event fires when the file is added to the directory which happens before any data is written to the file. Maybe you could try the CheckedIn event instead..
Hei Per.
Can I still use the event CheckedIn if the filesystem is a Native File System? Or will this only work if the filesystem is a Versionig File System?
BR,
Tore
protected void UnifiedDirectory_UnifiedFileAdded(UnifiedDirectory sender, UnifiedVirtualPathEventArgs e) { UnifiedFile addedFile = HostingEnvironment.VirtualPathProvider.GetFile(e.NewVirtualPath) as UnifiedFile; }