[Zope] Images and uploading

Harald Scheirich scheirich@nulleins.at
Wed, 28 Feb 2001 14:03:02 +0100


If you want the error checking to be done before the saving using 
ExtImage you probably would have to change extImage to do so and 
modify not to write anything that cannot be recognised as webviewable.

Using LocalFS you could write an External python function To check 
the data that you get via PIL to assert that the data that has been 
sent actually is an image befor it is written

making this up as i go along e.g.

I dont know if something like this would work
---------------------
# file is REQUEST['file'] where file is the
# form name for the input element

from PIL import Image

def isImage(file)
   try:
     im = Image.fromstring(data)
   except:
     return false
   return true
---------------------

I havent worked with LocalFS which i think 
HTTPRequest.upload.instance is from, is it ?

Harald

At 1:19 PM +0100 2/28/01, Paul Zwarts wrote:
>Thanks Harald,
>
>I do indeed have ExtFile loaded on my system, and had ignored it for the
>sake of figuring out LocalFS. Will give it a look now, but will it really
>help?
>
>It sounds like the same conundrum except that when depositing a file
>somewhere, the meta data is in fact captured and stored, and can be
>requested after is deposit. But what I want is this operation to occur
>beforehand.....
>
>Which makes me ask, how do I access the physical path of an
>HTTPRequest.upload.instance so I can perform a string.search?
>
>Paz