Angharad has asked for the wisdom of the Perl Monks concerning the following question:
The file is definately there .. if I click on the hyperlink there it is. I have also tried using the 'local path' .. you know the /home/mysite/uploaded_files/ type one, but the same error occurs.Software error: Can't process 'http://www.mywebspace.com/uploaded_files/text.txt': Fil +e does not exist!
Any suggestions much appreciated.#!/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();
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: CGI script .. cant find file
by duff (Parson) on Feb 15, 2006 at 18:32 UTC |