On Nov 19, 2006, at 4:27 PM, chiangf 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?
Try opening it with PIL and see if it barfs:
import Image
try:
Image.open(path_to_image)
except IOError, e:
if e.errno is None:
# Image is not valid
# PIL doesn't provide anything more meaningful :(
HTH,
Alberto
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---