Hi, The Content-Length header is not being sent, so Werkzeug punts and sets content_length=0.
To get the size yourself, try len(file.stream.getvalue()). Robin On Sep 22, 8:57 am, tom <[email protected]> wrote: > Hello, > > I'm trying to read the file size of an uploaded avatar before saving > it permanently. > > file = request.files['uploaded_file'] > if file: > filename = file.filename # this works > filesize = file.content_length # this is always zero > img = PIL.Image.open(file) # opening the file works > > I think I tried everything but it still doesn't work. Sometimes > file.tell() gives me the file size after using it with PIL, but not > reliably. I had the same problem with uploaded audio files but there I > could work around it by using a metatag reader. Can anybody spot my > mistake? I'd be glad to add more info if needed. > > Regards, > Tom --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "pocoo-libs" 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/pocoo-libs?hl=en -~----------~----~----~----~------~----~------~--~---
