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' ] ), #text/vnd.ms-word
file_max_bytes(1024000),
],
},
I've read some posts that seem related to this here:
http://thread.gmane.org/gmane.comp.lang.perl.modules.cgi-appplication/3926
and tried to edit Upload.pm to do the following to the $fh in use:
my $fake_fh = $query->upload('filename');
my $fh = \*$fake_fh;
but no luck. Also tried the other proposed workarounds (like Acme::Damn)
but no...
And something related. By reading CGI::Uploader docs, I thought that the
following should work:
my $valid_after_ul = $u->store_uploads( $self->query->Vars );
but no, it is not.
I'm stuck... Please, has anyone did this correctly? I'm I missing
something or doing something wrong?
Regards,
Giannis
---------------------------------------------------------------------
Web Archive: http://www.mail-archive.com/[email protected]/
http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]