Matt S
Matt S

Reputation: 23

upload a file to tmp folder flask python

I am trying to extract frames from gifs/videos that have been uploaded to the server through a post request. I have the code working to grab the file:

my_file = request.files['file']

however if that file is a gif or video I'm kind of stuck. The cv2 and Image package both require that the video or gif is stored in a file and you input the filename to grab the file, but that's not going to be possible as I'm not trying to store user data. So what I want to do is uppload it to a tmp folder, extract the frames then put it back, how could I go about doing that?

Upvotes: 0

Views: 4891

Answers (1)

darksky
darksky

Reputation: 2090

my_file.save("path/to/your/tmp/folder")

saves the uploaded file there.

Upvotes: 4

Related Questions