Greetings Kiko. There are a few ways to do this. Here's my attempt to show the raw basics. (Please don't try this in an enterprise solution...)
#!/usr/bin/perl -w use strict; use CGI; my $cgi = new CGI; my $filename = $cgi->param("formuploadinputname"); my($bytesread,$buffer,$total); open(OUTPUT, "> /var/home/me/somedirsomewhere/$filename"); binmode $filename; binmode OUTPUT; while ($bytesread = read($filename,$buffer,1024) ) { $total += $bytesread; if ($bytesread > 10000000) { # 10 meg filesize limit close(OUTPUT); unlink "/var/home/me/somedirsomewhere/$filename"; } print OUTPUT $buffer; } close(OUTPUT);
A much better (much much better) example of how to do this sort of thing safely is Re: File Upload To Selected Directory written by Ovid. Give that node a deep read-through and you'll have a lot to play with.
-gryphon
code('Perl') || die;
In reply to Re: Uploading Files
by gryphon
in thread Uploading Files
by Kiko
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |