use CGI qw/:standard/; $CGI::POST_MAX=1024 * $MaxSize; my $serverFile = $UploadDir . (split(/[\\\/]/, param('UserVideo')))[-1]; my $buffer; open (FILE,">$serverFile"); while (my $bytesread=read($filename,$buffer,1024)) {print FILE $buffer;} close (FILE);