in reply to Re: Proble with image on Perl-CGI
in thread Proble with image on Perl-CGI

Hi.. thanks for your reply..

i have shifted the 'upload' directory from /var/www/upload to var/www/cgi-bin/session/cgi/upload ......

and in script i have made the below changes,

my $upload_dir = "/var/www/cgi-bin/session/cgi/upload";

and

img src="/upload/$filename" alt="Photo" />

still it is not working...

Replies are listed 'Best First'.
Re^3: Proble with image on Perl-CGI
by moritz (Cardinal) on Mar 26, 2009 at 15:56 UTC
    if the URL starts with a /, it is interpreted relative to your domain name, not to the script (sorry if I was unclear about that).

    Please don't move upload directories into a cgi-bin dir, that might be a huge security risk. Let it stay in /var/www/upload, and link to it with href="/upload/$filename".

      i moved the 'upload' folder in to /var/www/

      and in i modified the script like below

      my $upload_dir = "/var/www/upload";

      and

      Photo

      sorry ... if i not understood..

        When you visit a website, such as http://www.example.com/upload/test.html, the web server is going to take everything after the domain (i.e. /upload/test.html), append that to what is usually called the Document Root (e.g. /var/www), and come up with a path of /var/www/upload/index.html.

        In your case, it looks like your document root is also /var/www. So, if you are uploading images into /var/www/upload/, then you want to point the browser to http://yourdomain.com/upload/$filename. You also have the option of dropping the domain and simply providing /upload/$filename.

      i have moved 'upload' folder to /var/www/

      and i modified my script with..

      my $upload_dir = "/var/www/upload";

      and

      Photo