|go ahead... be a heretic|
CGI.pm file uploads in very generic scriptby amelinda (Friar)
|on Nov 14, 2001 at 04:45 UTC||Need Help??|
amelinda has asked for the wisdom of the Perl Monks concerning the following question:
Look! I'm use CGI;ing! And you all thought I couldn't do it. Sadly, it is still legacy code. Arkayne legacy code.
So, it looks like they tried to implement something that was very generic, and attempts to handle potential (but not certain) multiple file uploads. Too bad it ends up with only the last one.
So, for the sake of sanity, I'm trying to do as little modification as possible. I'm looking at the CGI function append(); as a possible near-drop-in replacement for the use of param('foo','new value');. At this point, I need to know one thing: does append(); do a scalar (ie, smoosh into one big string) or list (ie, push value onto the end of an array) append?
FWIW, here is some sample code:
As you'll notice, the values of $q->param('_filedata'); and $q->param('_filename'); are overwritten every time through this loop. I'm not sure what the heck the original author was thinking, but he's (of course) not here now.
So, I'm hoping that $q->append(); will help me here by making an array out of _filedata and _filename. Think it will?