-------executing 1.upload.sh Can't open /home/bob/1.scripts/8.nik.pl: No such file or directory at /kunden/homepages/9/d349337426/htdocs/perl5/lib/perl5/CGI/Lite.pm line 862. Use of uninitialized value $readme in concatenation (.) or string at 1.upload.pl line 79. Use of uninitialized value $readme in at 1.upload.pl line 87. readline() on unopened filehandle at 1.upload.pl line 87. -------cat 1.upload.pl #!/usr/bin/perl # Simple example that displays the data associated with # the "readme" file field in a multiform/form-data request. use strict; use warnings; use CGI::Lite; my $cgi = CGI::Lite->new; # Die if the directory is invalid (i.e doesn't exist, can't # read or write to it, or is not a directory). $cgi->set_directory ("/tmp") or die "Directory doesn't exist.\n"; # Set the platform. "Unix" is the default. The method accepts # platforms in a case insensitive manner, so you can pass # "UNIX", "Unix", "unix", etc. $cgi->set_platform ("Unix"); # Set the buffer size to 1024 bytes (1K). This is the default. $cgi->set_buffer_size (1024); # Let's change the way uploaded files are named! $cgi->filter_filename (\&my_way); # Tell the module to return filehandles. $cgi->set_file_type ('handle'); # We want CGI::Lite to perform EOL conversion for all files that have the # following MIME types: # # application/mac-binhex40 # application/binhex-40 # # so, we use the add_mime_type method. In addition, we don't want # files of MIME type: text/html to be converted. I'm sure you wouldn't # want to do that in real life :-) $cgi->add_mime_type ('application/mac-binhex40'); $cgi->add_mime_type ('application/binhex-40'); $cgi->remove_mime_type ('text/html'); # Let's go ahead and parse the data! my $data = $cgi->parse_form_data; print "Content-type: text/plain", "\n\n"; if ($cgi->is_error) { my $error_message = $cgi->get_error_message; print <{readme}; print <) { print; } # Make sure to close the file! $cgi->close_all_files; } exit (0); sub my_way { my $file = shift; $file =~ tr/A-Z/a-z/; # Upper to lowercase $file =~ s/(?:%20)+/_/g; # One or more spaces to "_" $file =~ s/%[\da-fA-F]{2}//g; # Remove all %xx return ($file); }