SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Zealot
    Join Date
    Apr 2003
    Location
    UK
    Posts
    152
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Updating binary?

    Hello all,

    I've nearly finished putting together a couple of scripts that add binary data and text entries to a mysql database, update and delete them etc. but I'm stuck on one particular thing.

    I can bring a particular rows values back into a form so I can update them, but I can't figure out how I can bring the binary data (images)back into the form (possibly as a hidden form field) so that if the user wants to use the original image, then they wont have to choose another image to upload.

    Is this at all possible?

    Matt

  2. #2
    SitePoint Zealot
    Join Date
    Mar 2002
    Location
    Perth, Australia
    Posts
    157
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Matt

    Maybe it would be better/easier to just offer them the opportunity to upload a new image, but if they don't then just use the existing one? So make that field optional.

    OR, if you must do it, perhaps you could look at encoding the file in the same way as in a MIME email, using base64 encoding. See the PHP documentation on the imap_binary() and imap_base64() functions. Then you might be able to store it as a hidden form value. But I wouldn't think this is the best way of going about it.
    Paul Davey
    webmaster for Whitford Church of Christ

  3. #3
    SitePoint Addict
    Join Date
    Jan 2002
    Location
    NJ/NY
    Posts
    346
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Just an idea..
    You can make the image an input field with type image, and then use css to set the visibility to hidden. However, goin with bobbymac's suggestion seems easier and more practical.

  4. #4
    SitePoint Enthusiast
    Join Date
    Jan 2003
    Location
    San Diego
    Posts
    49
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    When I store images in a mysql database, I usually just put the image somewhere in the file structure (a normal folder), and store the path to the file in the database.
    Kyle Maxwell
    www.kylemaxwell.com


Bookmarks

Posting Permissions

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