I try to upload an image in the filesystem rather than in a database,
using the following code (note I run Perl on Windows XP with Apache
my $name = param("name");
my $image = param("image");
my $img_data = upload("image");
$name =~ s/^\s+//;
$name =~ s/\s+$//;
# Also work with while (<$image>); The upload("image") is not
# This is just an alternative to $image = param("image").
$img_buffer .= $_;
print IMAGEFILE $img_buffer;
If I modify the script and try to upload the image in the database as
blob type rather than in the filesystem everything works and I can
see the image in my browser if I serve it with an appropiate
function. But if I run the code as is, the image will be uploaded...
But I cannot see it in my Windows Picture and Fax Viewer. If I try to
open this image with Adobe Phptoshop, I receive the following error:
"Could not open "path\image.jpg" because invalid DQT JPEG QTable
number is found (it must be 4)"
I also tried to open it with another graphical software, but I
"Unknown file format" error.
Obviously, there is something incorrect in my code. Perhaps there is
some CR/LF corruption and the image is not properly parsed, perhaps I
should to escape $_ before fill $image_buffer, perhaps I must specify
some mime-type in a way that I ignore...
Some one can give my any idea?
Thanks a lot