baxy77bax has asked for the wisdom of the Perl Monks concerning the following question:

Fellow monks

I am in need of assistance. I need to make a simple cgi file load script that has a load bar. So if i have a file and want to upload it to the server it is necessary that load progress is displayed. I did some cgi scripting 5 years ago and I am simply amazed how little i remember about it.

to show you what I am aiming for : see this! but as far as i understood this is just a load bar without the actuall load function (right?).

please suggest as many potential solutions as you can. the only thing is it should be perl-based.

thnx

Replies are listed 'Best First'.
Re: File upload CGI script with load bar
by Corion (Patriarch) on Apr 09, 2015 at 11:04 UTC

    The main part of the solution will not be possible in Perl. You will need to use some Javascript library to manage the upload and display the progress bar. Google comes up with a random Stackoverflow answer.

Re: File upload CGI script with load bar
by hippo (Archbishop) on Apr 09, 2015 at 11:26 UTC

    If you really do want a pure-perl solution which can be used by all visitors to the page then that means relying on a back-end solution such as Raditha's MegaUpload. Otherwise, consider Corion's advice regarding a JS solution.

      While this may work, after taking a look at some of the code, I am uncertain if 1) it is a pure perl solution, and 2) if it is a safe solution.

      Headers are parsed by hand, there is a reference to upload2.php in the source (which I did not track down to see if it is used, or if it is just a leftover), creates the upload directory mode 777, assumes the browser puts the session id into the first parameter in the query string, <redacted /> there is a significant security issue with a remote exploit, .... I stopped looking after the last one.

      In short, this would be on a do not use list for me, about the same level as the original Matt's Script Archive code.

      Updates:

      • removed description of exploit pending notification of author, remove the "might not be safe" clause.
      • 2015-04-30T10:44-05:00 - No response from the author. Looking into method of applying appropriate pressure. If this is a "top 1% project", having this exposure could be a BadThing™

      --MidLifeXis

Re: File upload CGI script with load bar (mwahaha)
by Anonymous Monk on Apr 09, 2015 at 14:44 UTC