kirchaj
Posts: 215
|
Posted: 03/23/2015, 12:43 PM |
|
I am trying to validate a user's filename before inserting into the database. I am using the OnValidate event but it doesn't seem to be firing. Anyone else have this problem? Anyone else do the filename validate before it is uploaded?
TK
|
|
|
eratech
Posts: 513
|
Posted: 03/24/2015, 7:50 PM |
|
kirchaj - Yes, I have done OnValidate on the FileUpload control before (specifically to check my log of imported files for any duplicate filenames) but it does run.
Are you adding an Error, or setting the Validation flag to false (it defaults to true, which means all is fine)
For Example, I've done a count of filenames in my file log with the same name as the current import, and then in a Custom Code block:
if ($tmpcount_type > 0 ) {
$Component->Errors->AddError("ERROR: The selected file has already been uploaded. Change the filename if needed.");
$fileuploadlog_FileUpload1_OnValidate = false;
}
Eric
_________________
CCS 3/4/5 ASP Classic, VB.NET, PHP
Melbourne, Victoria, Australia |
|
|
MichaelMcDonald
Posts: 640
|
Posted: 03/29/2015, 1:53 AM |
|
I add a title field and have the filename changed to a random in classes.php before upload.
Then it does not matter if there are duplicate filenames.
_________________
Central Coast, NSW, Australia.
|
|
|
|