Check out the CGI documentation - it's very thorough and has a lot of
excellent examples.  Looking at the synopsis example, it looks like you're
missing an if ($q->param()) { ... } around the file uploading part of your
code.  Give that a shot...

Jason

> here it is:
> #!/usr/bin/perl
> use CGI;
> $q = new CGI;
> print   $q->header,
>  $q->start_html('title here'),
>  $q->h1('Please fill this form'),
>  $q->start_multipart_form,
>  $q->filefield(-name=>'uploaded_file',
>                             -size=>50,
>                             -maxlength=>80),
>  $q->submit,
>  $q->end_form,
>  $q->hr;

if ($q->param()) {
> $file=$q->upload('uploaded_file');
> if (!$file && $q->cgi_error)
>
>       print $q->header(-status=>$q->cgi_error);
>       exit 0;
> }
> open(FILE, ">/home/eHytham/public_html/upload.it");
> while($bytesread=read($file,$buffer,1024)){
>  binmode STDOUT;
>  binmode FILE;
>  print FILE $buffer;
> }
> close(FILE);
}

Reply via email to