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

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".

Replies are listed 'Best First'.
Re^4: Proble with image on Perl-CGI
by daynite (Initiate) on Mar 26, 2009 at 16:14 UTC

      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.

Re^4: Proble with image on Perl-CGI
by daynite (Initiate) on Mar 26, 2009 at 16:37 UTC