I thought I tried that. Do I need to create the temp file first? That I did not do. I was hoping for something more automatic.
I will just create the temp file myself if that's the proper procedure. Thanks Stefan. I appreciate the help. Nicky On Saturday, February 3, 2018 at 12:15:09 PM UTC-7, Stefan Adams wrote: > > Do you just need to move it to a file with move_to? Test if the object is > a memory object and if so move_to a file and then proceed like normal? > > On Feb 3, 2018 1:10 PM, "Nicky" <[email protected] <javascript:>> wrote: > >> Hello, >> >> I am writing a plugin that is meant to process uploaded files. However, >> when I upload a small file it internalizes as a Mojo::Asset::Memory >> object. >> I want to ensure only Mojo::Asset::File is used. >> >> For testing I simply : >> MOJO_MAX_MEMORY_SIZE=1 PERL5LIB=lib ./bin/driver.pl >> >> However, I would prefer a mechanism that is scoped within my plugin. >> >> I have tried various ways to set max_memory_size and trigger an upgrade >> but I just don't get it right. Here is the relevant code snippet. >> As you can see, if the upload is a Mojo::Asset::Memory object the >> external command execution won't work. >> >> $r = $routes->post( '/constellation/lint' => sub { >> my $c = shift; >> >> # Check file size >> return $c->render(text => 'File is too big.', status => 200) >> if $c->req->is_limit_exceeded; >> >> # Process uploaded file >> return $c->redirect_to('form') unless my $miffile = >> $c->param('mif'); >> >> my $size = $miffile->size; >> my $name = $miffile->filename; >> my $path = $miffile->asset->path; >> my @cmd = @CMD; >> push @cmd, $path; >> my ($out, $err); >> run3 \@cmd, undef, \$out, \$err; >> >> ... >> } >> >> Any pointers would be appreciated. >> >> Nicky >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Mojolicious" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected] <javascript:>. >> To post to this group, send email to [email protected] >> <javascript:>. >> Visit this group at https://groups.google.com/group/mojolicious. >> For more options, visit https://groups.google.com/d/optout. >> > -- You received this message because you are subscribed to the Google Groups "Mojolicious" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/mojolicious. For more options, visit https://groups.google.com/d/optout.
