[Israel.pm] file upload succeed on FF and failed on IE
Shlomi Fish
shlomif at iglu.org.il
Tue Jul 24 20:34:44 EEST 2007
Hi Sagiv!
First of all, let me note that I found it difficult to understand your
message, due to many formatting problems. Secondly, it would be useful if you
could provide a complete example that fully reproduces the problem, rather
than an incomplete snippet.
On Tuesday 24 July 2007, Sagiv Barhoom wrote:
> hi all I am trying to write page which upload files to the server .
> of FF it works fine .
> but on IE I just cn not get the file hanle from CGI::upload.
> the form tag is :
> <form action="cgi-bin/upload" method="post"
> enctype="multipart/form-data">... <input
> onclick="document.file_form.file1.focus();"
> name="file1" type="file" /><br />
>
> the error log file complain on: "'file1' : Inappropriate ioctl for device
> -"
>
What is the purpose of the onclick="" JS handler? Does it happen without it?
>
> and here part of the script:
> ###----------------------------------------------------------
> my $upload_filehandle = $q->upload($k)
Note: you shouldn't call your CGI object handler "$q". "$cgi" or whatever is
better and more descriptive.
>
> ||$logger->warn(__LINE__,"could not create file handle of '$k': $! - ".
>
> $q->cgi_error);
> $logger->debug(__LINE__, "upload_files: upload info:".Dumper
> $q->uploadInfo($upload_filehandle));
>
> open UPLOADFILE, ">$UPLOAD_DIR/$filename_to_write" or
I see several problems here:
1. You used a glob instead of a lexical filehandle.
2. Due to #1 you didn't perldoc -f local the glob, which may also cause
problems.
3. $UPLOAD_DIR starts with a capital letter.
4. You used open $fh, ">$path" instead of the safer open $fh, ">", $path.
5. Does $filename_to_write assure that there are no collisions?
> $logger->warn(__LINE__, "upload_files: failed to open $filename : $!");;
> binmode UPLOADFILE;
>
> $logger->debug(__LINE__, "upload_files: open binmode
> $UPLOAD_DIR/$filename_to_write");
> while ( <$upload_filehandle> ){
> print UPLOADFILE;
> }
> close UPLOADFILE or
> $logger->warn(__LINE__, "upload_files: failed to close
> $filename_to_write : $!");
>
Regards,
Shlomi Fish
---------------------------------------------------------------------
Shlomi Fish shlomif at iglu.org.il
Homepage: http://www.shlomifish.org/
If it's not in my E-mail it doesn't happen. And if my E-mail is saying
one thing, and everything else says something else - E-mail will conquer.
-- An Israeli Linuxer
More information about the Perl
mailing list