title: Why is this Perl CGI script failing to upload images correctly?
body: <p>I have this code:</p>
  
  <pre><code>use CGI;    
  use File::Basename;    
  use Image::Magick;    
  use Time::HiRes qw(gettimeofday);    
  my $query = new CGI;    
  my $upload_dir = "../images"; #location on our server    
  my $filename=$query-&gt;param("img");    
  my $timestamp = int (gettimeofday * 1000);    
  my ( $name, $path, $extension ) = fileparse ( $filename, '\..*' );     
  $filename = $name ."_".$timestamp. $extension;    
  
   #upload the image
  
  my $upload_filehandle =$query-&gt;param("img");    
  open ( UPLOADFILE, "&gt;$upload_dir/$filename" ) or die "$!";  
   binmode UPLOADFILE;  
   while ( &lt;$upload_filehandle&gt; )  
    {  
     print UPLOADFILE;  
     }  
  
    close UPLOADFILE;
  </code></pre>
  
  <p>Then I do resize for the image. My problem is that the image is not uploaded. I have an empty file having the name of $filename. I omitted the part related to resize and I still have the code. So I'm sure that the file is not being uploaded correctly. Am I missing any library?
  Any help?Plz..</p>