I’m using Umbraco 4.5.2 and I have a document with an Upload property.
I would restrict the upload only to pdf files with a size not too large.
I created a class that captures the event Document_BeforeSave and I test sender.getProperty("umbracoFile").Value.ToString().Length > 0
With debug, I note that, when I click on Save icon, the function is executed twice.
Beginning of the first round, the folder under the Media with the id assigned to the property has not yet created. After the first round, the folder has been created and contains the uploaded file.
In both function calls sender.getProperty("umbracoFile").Value.ToString() is equal to 0.
I wanted to cancel the save (and avoid saving the file to the folder) if the file extension is different from the pdf but this is not possible because the value sender.getProperty("umbracoFile").Value.ToString()is always 0.
How can I proceed?
Another question: how I can display a red message on interface to alert the user that the file type is incorrect?
Upload file - how I avoid save
Hi.
I’m using Umbraco 4.5.2 and I have a document with an Upload property.
I would restrict the upload only to pdf files with a size not too large.
I created a class that captures the event Document_BeforeSave and I test sender.getProperty("umbracoFile").Value.ToString().Length > 0
With debug, I note that, when I click on Save icon, the function is executed twice.
Beginning of the first round, the folder under the Media with the id assigned to the property has not yet created. After the first round, the folder has been created and contains the uploaded file.
In both function calls sender.getProperty("umbracoFile").Value.ToString() is equal to 0.
I wanted to cancel the save (and avoid saving the file to the folder) if the file extension is different from the pdf but this is not possible because the value sender.getProperty("umbracoFile").Value.ToString() is always 0.
How can I proceed?
Another question: how I can display a red message on interface to alert the user that the file type is incorrect?
Thanks.
Daniela
is working on a reply...