Most of the time, it's a bad idea to insert large data
like pictures into a database, as SQL is not really standardized
about how big BLOBs (== binary large objects or something like that)
are allowed to become.
I suggest that you create a unique filename for your image
and then save the uploaded image on the disk and a link
to that image in your database.
If you really really really need to store your
images in the database (and your images are all guaranteed
to be smaller than 4k, because many databases have problems
with larger entries), you will have to encode your images
to make them SQL-safe and then store them like any other
value. Why making them SQL-safe ? You wouldn't want a user
to upload a cleverly crafted image that executes some valid
SQL code on your database, for example dumping all password
data.
But in general I think it's a better solution to store the
files themselves out of the database.
I just saw that you will be using Win32::ODBC
to access your database - be prepared for even weirder
limits on field size, as now both the ODBC driver and
the database impose limits on your data.
|