Angharad has asked for the wisdom of the Perl Monks concerning the following question:
The cgi script is located in my /public_html/cgi-bin (of course) and my file in a directory called /public_html/uploadedfiles
I don't understand why my script is not finding the file ... it is certainly there and at that location.
Code follows
Any help 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/; #print "Content-type: text/html\n\n" # # Upload directory for files # my $upload_dir = "/home/me/uploaded_files"; my $file = "file.txt"; # # Path to PDB processing program # my $program = "/home/me/programs/program"; # # Get the name of the file to process from the command line # Later we will get this from the input to the CGI program # #my $input_file = shift; my $input_file = "$file"; #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"; # # Create web page... # print start_html("Processing PDB file '$input_file' ..."), $/, h1("Processing PDB 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: where art thou file?
by liverpole (Monsignor) on Feb 28, 2006 at 12:11 UTC | |
by Angharad (Pilgrim) on Feb 28, 2006 at 12:28 UTC | |
by dorward (Curate) on Feb 28, 2006 at 13:48 UTC | |
by Angharad (Pilgrim) on Feb 28, 2006 at 14:42 UTC | |
by liverpole (Monsignor) on Feb 28, 2006 at 12:42 UTC | |
|
Re: where art thou file?
by idle (Friar) on Feb 28, 2006 at 12:27 UTC | |
by Angharad (Pilgrim) on Feb 28, 2006 at 12:31 UTC |