got OSError when use pillow to deal with my jpg image
问题 I'm post a jpg picture to my website (build on django), but I got "OSError at url XXXX/XXX broken data stream when reading image file" when I use pillow to deal with it it happens when run the code in server : if request.FILES: img = request.FILES['img'] ftype = img.content_type.split('/')[1] image = Image.open(img) imagefit = ImageOps.fit(image, (200, 200), Image.ANTIALIAS) fpath = MEDIA_ROOT+'avatar/'+user.username+'.'+ftype getpath = 'avatar/'+user.username+'.'+ftype imagefit.save(fpath