Hi there
I posted earlier on regarding a premature end to script header' problem I was having with a cgi script.
Anyway... I went away and modified my program after reading peoples comments. I caught a few errors that I sorted out ... but am confused regarding this one
Software error: Can't process 'http://www.mywebspace.com/uploaded_files/text.txt': Fil +e does not exist!
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.
Here is the code again
#!/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();
Any suggestions much appreciated.

In reply to CGI script .. cant find file by Angharad

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.