Hi to all!
I am trying to implement a script which upload a fix file from a fixed local directory to a fixed web directory, which will be happened everyday, so that i am trying to some automated process so that I don't have to FTP that file everyday. I have tried the following methode, its uploading the file from loacl machine to the web directory through a form, but the problem is it can't read the file size, so its copying 0 bite size file. (but if chose the file from this Form and say upload its working fine, but if I supply the local directiry path its not working) the code as follows:

Code:
my $file_query1 = 'D:\work for people\k****ij\oil1.shtml';
sub Upload  {
 my($query, $upload_dir) = @_;
    my($file_query, $file_name, $size, $buff, $time, $bytes_count);
 $size = $bytes_count =0;
 $_ = $file_query1;
 s/\w://;
 s/([^\/\\]+)$//;
 $_ = $1;
 s/\.\.+//g;
 s/\s+//g;
 $file_name = $_;
  
open(FILE,">$upload_dir/$file_name") || &Error("Error opening file $file_name for writing, error $!", 1);
    binmode FILE;
   $time=time();
     while ($bytes_count = read($file_query,$buff,2096)) {
     $size += $bytes_count;
        print FILE $buff;
     }
    close(FILE);
print "completed<br><br>";
}
in the code this following portion is not working:
Code:
open(FILE,">$upload_dir/$file_name") || &Error("Error opening file $file_name for writing, error $!", 1);
    binmode FILE;
   $time=time();
     while ($bytes_count = read($file_query,$buff,2096)) {
     $size += $bytes_count;
        print FILE $buff;
     }
    close(FILE);
can any one please tell me where i have made mistake? if you need any more information please let me know.
thanks in advance.
Sujata.