I've got a media before save event and in that event I would like to check if a new file has been uploaded with the upload datatype. Some parts of the event only need to be triggerd (like resizing) if a new file is uploaded. Any idea how I can check this?
Property pathProp = new Media(mediaId).getProperty("umbracoFile"); if (pathProp != null && pathProp.Value != null && !string.IsNullOrEmpty(pathProp.Value.ToString())) { //Get the date when the file was last modified. DateTime modification = File.GetLastWriteTime(HttpContext.Current.Server.MapPath(pathProp.Value.ToString()));
//Check if the file is updated less than a minute ago. isUpdated = modification > DateTime.Now.AddMinutes(-1); }
Check if new file is uploaded
Hello,
I've got a media before save event and in that event I would like to check if a new file has been uploaded with the upload datatype. Some parts of the event only need to be triggerd (like resizing) if a new file is uploaded. Any idea how I can check this?
Jeroen
Anyone know how I can do this?
Jeroen
I fixed it by using File.GetLastWriteTime
Jeroen
is working on a reply...