[Zope] VarImage, Problems with uploaded files.

Edward Pollard pollej at uleth.ca
Wed Sep 17 17:20:22 EDT 2003


Good afternoon all,

I would like to use the VarImage product as part of a "notice board" 
project. Different ways data is access demand different sizes for the 
graphics, and the VarImage product seems to be the right tool for the 
task...almost. These will be graphics uploaded by the end user via a 
form, and I've encountered two problems where it seems VarImage ate my 
Zope server, presumably due to "bad input".

1) A huge JPG (~10MB) was uploaded. The server then died.
2) A bitmap was uploaded instead of a jpg/gif. The server then died.

Both scenarios are repeatable, but by no means are my diagnosis skills 
sophisticated to comment any further on what's going on. So as a 
preamble to my actual question I'd welcome advice on how to more 
properly figure out whats going on here. It seems that processing 
threads are getting sent off into the wild blue yonder and never ever 
coming back.

I figure the only way I can use VarImage for my needs is if I make sure 
that files are <500k and if they are actually gifs of jpegs.

So my *actual* question is:

How can I tell if an uploaded file is a gif or a jpg? I know I'll 
probably need to look at the first 4 bytes for some kind of code, but I 
don't know what that is (nor exactly how to do it) and am dead certain 
that someone out there has done this already.

Thanks

---
Edward J. Pollard
University of Lethbridge
Web Development





More information about the Zope mailing list