Software error: Can't process 'http://www.mywebspace.com/uploaded_files/text.txt': File does not exist! #### #!/usr/bin/perl -wT # ensure all fatals go to browser during debugging and set-up # comment this BEGIN block out on production code for security BEGIN { $|=1; print "Content-type: text/html\n\n"; use CGI::Carp('fatalsToBrowser'); } use strict; use warnings; use diagnostics; use CGI qw/:standard/; # Upload directory for files my $upload_dir = "http://www.mywebspace.com/uploaded_files"; my $file = "file.txt"; # Path to processing program my $program = "/home/mywebsite/programs/program"; # Get the name of the file to process from the command lin my $input_file = "$file"; # Create web page... print start_html("Processing file '$input_file' ..."), $/, h1("Processing file '$input_file' ..."), $/; chdir $upload_dir; die "Usage: $0 INPUT_FILENAME\n" unless $input_file; die "Can't process '$upload_dir/$input_file': File does not exist!\n" unless -f "$upload_dir/$input_file"; open (PROG, "| $program") || die "Can't run '$program': $!\n"; print PROG "$input_file\n"; close(PROG); print p("OK .. working thus far"), end_html();