Search code examples
perlfile-uploadwww-mechanize

Is it possible to send a file from the client computer on a perl web application without uploading it to the server first?


I've looked for this around the internet without getting any good answer so far, so here's the issue:

I have a perl web application used by a small group of people (accessed by their web browser on windows computers, around 100 users) , on an intranet (this application is on a RedHat Apache server) , this application gets the user's inputs and uses WWW::Mechanize to send everything to another page on (a different server, which shouldn't be used directly), process a form and return the result (I know it may not sound optimal, but it was done according to what was required), the issue here is that I need the users to be able to send a file (most likely it will be an image of ~500kB, either through WWW::Mechanize along with the other form data that gets submitted, or by an email with an attachment, either option is equally acceptable), and I know the file can be sent/attached if it's already on the server, my question is simple:

Is it possible to send a file from the client computer (running the perl web application on the browser) without uploading it to the server (that will send it) first?

P.S. This is not one of those "give me the code" questions, I'm not asking for any specific code, I just want to know if this is something that could be done (and if it is to have an idea how), or if I absolutely have to upload the file to the server running the perl application first (I already have a script for that). If this is not possible it's ok, I just want to be sure if I need to upload to the server first before sending the file.


Solution

  • Assuming I understand you correctly, yes, you can upload a file through WWW::Mechanize. See the pb-upload example.