Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Jan 2003
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question PHP Image Upload

    ive got a question, i wanna upload a image and save it directly to mysql database ?

    do i follow the common upload php rutine and then set the file to a variable and save it to a large blob on mysql ??

    Last edited by ricardovw; 03-10-2003 at 01:46 AM.

  • #2
    Senior Coder Nightfire's Avatar
    Join Date
    Jun 2002
    Posts
    4,265
    Thanks
    6
    Thanked 48 Times in 48 Posts
    Best way I found was to save the image to a directory, then just put the path to the image in the database.

  • #3
    Regular Coder
    Join Date
    Jun 2002
    Location
    UK
    Posts
    577
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Yup nightfire, certainly saves on the overheads when you come to output the image.
    Always did wonder why some people store non-changing data in a database - perhaps they just don't really know what a database is for.
    Ökii - formerly pootergeist
    teckis - take your time and it'll save you time.

  • #4
    New Coder
    Join Date
    Oct 2002
    Location
    Ghent, Belgium
    Posts
    45
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I've always wondered what image data is doing in a database. Could anyone give me a concrete example where storing in the DB makes more sense than storing the image's path?
    Those innocent fun games of the hallucination generation

  • #5
    Regular Coder
    Join Date
    Jun 2002
    Location
    UK
    Posts
    577
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Well - databases are used rather than flatfile for when either - you change the data a lot or you need to search the data.

    Now images - even if you change the image every 30 seconds, the overhead of database calls negates any good points there. So I assume most people who store images in databases have to search the binary data for something - so I guess they write some app that converts their ascii search term to binary and then checks the database - very long winded when you've got functions that can do that for flatfile stored images.

    Or maybe they just put images in their databases because it sounds clever (in much the same way as IIS server sounds clever )

    Ricardo - you might have guessed by now that we reccommend storing the image as a flatfile and just saving the path in the database.
    Ökii - formerly pootergeist
    teckis - take your time and it'll save you time.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •