posting image data (not url) from HTML to Perlscript

E

Eadmund

Hi,

I'm trying (and failing) to post an image that a user has uploaded in
an HTML page to a perl script, store it in SQL 2005 (using the new
image data type), and then get the image back and display it embedded
in HTML using perl.

When I look at the form vars that I post back, the image form var just
says "object" where I would expect there to be a huge blob of data
representing the image.

Anyone got an example of how image data is posted back from a web page
to perl script, and the accessed. (the SQL DB bit I've got going no
probs)

Regards

Tufty
 
B

Bart Van der Donck

I'm trying (and failing) to post an image that a user has uploaded in
an HTML page to a perl script, store it in SQL 2005 (using the new
image data type), and then get the image back and display it embedded
in HTML using perl.

When I look at the form vars that I post back, the image form var just
says "object" where I would expect there to be a huge blob of data
representing the image.

Anyone got an example of how image data is posted back from a web page
to perl script, and the accessed. (the SQL DB bit I've got going no
probs)

It's recommended to use CGI.pm for file uploads:

http://search.cpan.org/dist/CGI.pm/CGI.pm

But the major concern in your strategy is the storage of binary objects
in your DB. The better way is to store them in some directory, and then
reference them from within your DB (either by renaming the image(s) to
a corresponding unique ID/code in the table, or by storing the image
name(s) in stead of the entire object). The application can then decide
which image(s) belong to which data and you'll save much database
memory.

Hope this helps,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,049
Latest member
Allen00Reed

Latest Threads

Top