Giannis Economou wrote:
Hello all...Has anyone use CAP::ValidateRM validating file uploads, together with CGI::Uploader successfully?Unfortunately I'm trying to make them work together but can't make it right. The problem is that the mime-type of the upload can not be determined correctly by CGI::Upload.Some source:my ($results, $err_page) = $self->check_rm('reg_services','_services_profile'); if ($err_page) { $self->log->debug("Found validation errors in submission"); return $err_page; }my $valid = $results->valid; my $u = CGI::Uploader->new( spec => { letter_file => {} },updir_url => $self->get_app_config('BaseURL') .'/externals/',updir_path => $uploads_path, dbh => $self->dbh, query => $self->query, up_table => 'uploads', ); my $valid_after_ul = $u->store_uploads( $valid ); and in the validation profile: constraint_methods => { letter_file => [file_format( mime_types => [ 'application/pdf','application/msword' ] ),file_max_bytes(1024000), ], },
Update:
When commenting the constraint as follows:
constraint_methods => {
letter_file => [
#file_format( mime_types
=> [ 'application/pdf','application/msword' ] ), #text/vnd.ms-word
file_max_bytes(1024000),
],
},
CGI::Upload is able to determine the mime type fine. But with the line:
file_format( mime_types => [ 'application/pdf','application/msword'
] ),
not commented, CGI::Upload can not determine the MIME type and always
inserts "application/octet-stream" with ".bin" extension in the database.
It seems like a bug? If both CGI::Upload and Data::FormValidator::Constraints::Upload try to get the mime type, Data::FormValidator::Constraints::Upload (as the first one) does it successfully, but CGI::Upload fails afterwards.
Regards,
Giannis
---------------------------------------------------------------------
Web Archive: http://www.mail-archive.com/suppressed/
http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: suppressed
For additional commands, e-mail: suppressed
Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.