yeah! Glad to hear it. I know this doesn't exactly answer your question, but I would strongly recommend *not* storing the images in the database. There is a really cool way to modify your model using "magic attributes" so that uploaded files *look* like they are stored in the database, but are actually stored on the filesystem. This lets you use all the common image editing libraries (like PIL) with fewer headaches! Check out Ian Bicking's excellent documentation: http://www.sqlobject.org/SQLObject.html#adding-magic-attributes-properties
As far as validating whether the file is an Image, I believe you will want to check the "mime-type" on the uploaded image. In your controller, just do a "from cherrypy import cpg" and then print the mime-type of your file object (let's pretend your file-upload form field was named file1) like this: print "MIME-type: %s" % cpg.request.fileTypeMap['file1']. more details here: http://www.cherrypy.org/wiki/FileUpload (is it just me, or are there a whole lot of Ian's on this list right now? I love it!) -ian charnas On Nov 19, 10:27 am, "chiangf" <[EMAIL PROTECTED]> wrote: > Ian, > You hit the nail on the head when you said that the filename was > non-ascii. I've actually been trying to upload images. So I tried a > text file and it worked! > > But now, I'm a little puzzled. How do I make it work for images? My > MYSQL table is a mediumblob, so it should be able to take in binary > values. > > On a side note, is there a good way of validating whether a file is an > image? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "TurboGears" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/turbogears?hl=en -~----------~----~----~----~------~----~------~--~---

