title: How can I display my image?
body: <p>I have no idea why it doesn't work as I am trying to upload it to a certain directory.</p>
  
  <pre><code>#!/usr/bin/perl use CGI qw(:standard);
  #use strict;
  
  my $cgi         = new CGI;
  my $upload_dir  = '/home/...';
  
  my $max_files   = 3; #maximum number of files allowed.
  print $cgi-&gt;header(-type =&gt; 'text/html');
  for (my $count = 1; $count &lt;= $max_files; $count++){
      my $filen    = "file".$count;
      my $file     = $cgi-&gt;param($filen);
      my $filename = $file;
      $filename    =~ s/^.*(\\|\/)//g;
  
      if($file)
      {
          open(OUT, "&gt;$upload_dir/$filename") || die print "Fail to upload: $!";
          while(&lt;$file&gt;) {
              print OUT;
          }
          close(OUT);
      }
  }
  
  print "File(s) Uploaded\n";
  
  print qq~
          &lt;HTML&gt;
         &lt;head&gt;&lt;/head&gt;
         &lt;body&gt;
         &lt;h1&gt;
         &lt;img src="path/to/myimage"&gt;
         My Name is blabla.
         &lt;/h1&gt;
         &lt;/body&gt;
         &lt;/HTML&gt; ~;
  </code></pre>
  
  <p>I got my image file uploaded to the document root, but for some reason, the page can't display the file.</p>