Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Inserting Blobs

JonathanJonathan Member Posts: 2,914
Hi,

I'm using the Perl DBI interface to access a MySQL server, query it, insert data etc, and it's going great...however there is one thing I cannot work out. I know you can store huge amounts of data in the database, using the Blob data types, but what I need to know is how to insert this data? Putting it in a normal insert, e.g.

$dbh->do(qq{
INSERT INTO people (name, image) VALUES('$name', '$image')
});

Where $image contains an uploaded image, just doesn't work! So how exactly is it done?

Thanks a lot!

Jonathan


------------------------------------------
Count downloads from your site for free!
http://www.downloadcounter.com/

Comments

  • jcarlssonjcarlsson Member Posts: 21
    : Hi,
    :
    : I'm using the Perl DBI interface to access a MySQL server, query it, insert data etc, and it's going great...however there is one thing I cannot work out. I know you can store huge amounts of data in the database, using the Blob data types, but what I need to know is how to insert this data? Putting it in a normal insert, e.g.
    :
    : $dbh->do(qq{
    : INSERT INTO people (name, image) VALUES('$name', '$image')
    : });
    :
    : Where $image contains an uploaded image, just doesn't work! So how exactly is it done?


    do you have the ability to upload files through the browser to your server and then changing the name on them? because if you can maybe you should upload the images as a file into a special folder and change the name on it to something like abc123 so it will have a unique name (every picture) and then just entering the name of the file in the db
    [red]--[/red]
    [green]jcarlsson[/green] [blue]<[/blue][purple]jcarlsson@linux.nu[/purple][blue]>[/blue]
    [red]http://www.jcarlsson.tk[/red]

  • JonathanJonathan Member Posts: 2,914
    Hi,

    Yes, I know you can do this - this is my current workaround. I'm just after the real solution, if you know what I mean. :)

    Thanks a lot anyway!

    Jonathan


    : : Hi,
    : :
    : : I'm using the Perl DBI interface to access a MySQL server, query it, insert data etc, and it's going great...however there is one thing I cannot work out. I know you can store huge amounts of data in the database, using the Blob data types, but what I need to know is how to insert this data? Putting it in a normal insert, e.g.
    : :
    : : $dbh->do(qq{
    : : INSERT INTO people (name, image) VALUES('$name', '$image')
    : : });
    : :
    : : Where $image contains an uploaded image, just doesn't work! So how exactly is it done?
    :
    :
    : do you have the ability to upload files through the browser to your server and then changing the name on them? because if you can maybe you should upload the images as a file into a special folder and change the name on it to something like abc123 so it will have a unique name (every picture) and then just entering the name of the file in the db
    : [red]--[/red]
    : [green]jcarlsson[/green] [blue]<[/blue][purple]jcarlsson@linux.nu[/purple][blue]>[/blue]
    : [red]http://www.jcarlsson.tk[/red]
    :
    :


    ------------------------------------------
    Count downloads from your site for free!
    http://www.downloadcounter.com/

  • jcarlssonjcarlsson Member Posts: 21
    : Yes, I know you can do this - this is my current workaround. I'm just after the real solution, if you know what I mean. :)

    if I don't remember this wrong, many of the bigger communities use this method, but some of them use other methods aswell, maybe you can find a script for placing images in a db somewhere on the internet, I don't realy know about that but I know that you can find very much on the internet if you look at the right place
    [red]--[/red]
    [green]jcarlsson[/green] [blue]<[/blue][purple]jcarlsson@linux.nu[/purple][blue]>[/blue]
    [red]http://www.jcarlsson.tk[/red]

Sign In or Register to comment.