Why do the seek(0)?

Would the pointer not be at zero anyway?

On Friday, March 30, 2012 6:43:14 PM UTC-4, Massimo Di Pierro wrote:
>
> yes and no. The file is not loaded in memory and then written to file. It 
> is uploaded into temp (request.vars.field.file points to the temp file) 
> then shuil.copyfile from temp to the destination. You can compute the hash 
> from request.vars.field.file then request.vars.field.file.seek(0)
>
> On Friday, 30 March 2012 13:51:18 UTC-5, Anthony wrote:
>>
>> Let me put it this way:
>>> Can I determine the hash of an uploaded file during the upload process 
>>> (when the form is submitted) and before it is actually stored on the 
>>> filesystem?
>>>
>>
>> I haven't been following this thread, but that sounds doable. When the 
>> file is uploaded, request.vars.file.file will hold the file object, and 
>> request.vars.file.filename will hold the original filename, so you could do 
>> something with those values before calling form.process(). You can also 
>> specify an onvalidation function via form.process(..., 
>> onvalidation=myvalidation), and I believe the function will be called 
>> before the file is stored.
>>
>> Anthony 
>>
>

Reply via email to