in reply to where art thou file?

    ... my file in a directory called /public_html/uploadedfiles

Are you sure that's where your file is supposed to be?  According to your code:

# # Upload directory for files # my $upload_dir = "/home/me/uploaded_files"; # ... 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";
So I'm not seeing any place where you reference /public_html/uploadfiles (or even just uploadfiles) in your program.

Maybe you have a symbolic link from /home/me to /public_html, and you meant uploadedfiles (without the underscore) in the program?

And what do the logs say?  Try running tail -100f /var/log/httpd/error_log in a separate window before you run it, for extra information.


@ARGV=split//,"/:L"; map{print substr crypt($_,ord pop),2,3}qw"PerlyouC READPIPE provides"

Replies are listed 'Best First'.
Re^2: where art thou file?
by Angharad (Pilgrim) on Feb 28, 2006 at 12:28 UTC
    hi, thanks for your reply.
    /home/me etc refers to the local directory system on the server. I'm utterly confused by the public_html concept to be honest, because apaprently you are not supposed to include that in your path.
    On my server ... it says /public_html/uploadedfiles. I *think* that corresponds to /home/me/uploadedfiles for some reason. If anyone could explain why tat is to me, I would appreciate that also :)
    The log files say that the file isn't found by the way.

      Generally speaking (i.e. in every case I've encountered) /home/USERNAME/public_html corresponds to either http://www.example.com/~USERNAME/ or http://USERNAME.example.com/.

      Thus you should not include "public_html" in your URL path. It is still a real directory on the filesystem so it should appear when referencing the filesystem path.

      Inside the Perl script it is a filesystem path, but outside the Perl script (i.e. in any HTML your script outputs) then it is a URL path.

        Thanks again for the advice. All much appreciated
      Hi again,

      Try looking at the configuration file for httpd.  It's someplace like /etc/httpd/conf/httpd.conf  I am by no means an expert at html/cgi (although I'm trying to learn!), but I know that httpd.conf is where things like Apache pathname configuration are handled.  Basically, you can define which directory will be the starting point for a given URL pointing to your server.  Note that the starting point may differ depending on whether you're executing a script (CGI) or simply fetching a file.  So if you have /public_html configured as the "starting point", an URL which references your server will access files relative to the /public_html directory.

      You may also want to read some of the Apache/http documention (try a Google for "configuring html", or something similar).  Good luck!


      @ARGV=split//,"/:L"; map{print substr crypt($_,ord pop),2,3}qw"PerlyouC READPIPE provides"