CodeCharge Studio
search Register Login  

Visual Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 onValidate file upload

Print topic Send  topic

Author Message
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
View profile  Send private message
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
View profile  Send private message
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.

View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.