Good day to all!
So, I have been trying to put an upload function on my python-flask application. It does scan the picture for backdoors, malicious files, etc etc and then checks if it is an image using imghdr.what()
which works perfectly until i used file.stream.read method
. this method can only read the stream once. after you read it. it returns ' '
or empty. below are the screenshots.
This is the debugger output:
This is my code:
And this is the files that it saved. all 0 byte:
If i remove the partthat scans for malicious codes on the image ( the part where i used file.stream.read() ) the upload function works fine. Thankyou in advance :)