XP is just a number | |
PerlMonks |
Re: Saving .cgi Output; Passing File As Argument?by thewebsi (Scribe) |
on Oct 20, 2014 at 19:37 UTC ( [id://1104485]=note: print w/replies, xml ) | Need Help?? |
I'm not sure if this is able to be done due to the nature of the input which is a file ... I tried something like: ... However the output html file I get just gives me my invalid file message so it doesn't look like it takes the input in that way. The input is not a file, but an HTTP request. The HTTP request content includes the file embedded in it. As you are suggesting running the script again using the command-line, this might be the simplest approach. Most (Plack-based) modern Perl web frameworks provide a command-line tool for doing this, so if you are using one of those, then check the documentation for it. For generic web servers such as a LAMP setup, you can use wget, curl, or lwp-download. Check the documentation on those for how to POST a request with a file attached. Windows has similar tools available. Watch out for recursion if you do this! To avoid running the script twice, a more generic approach is to use a filter/handler. Again, this depends on the web framework, as any framework that buffers output can make this very easy to do. For Apache, check out: http://httpd.apache.org/docs/current/handler.html#examples
Arnon Weinberg Back2Front - The Web Site People
In Section
Seekers of Perl Wisdom
|
|