Hi,
I've written a python cgi app that lists image files in a directory then when the user clicks on a link it converts the image to a .jpg and displays it in a simple html page. I'm using tempfile.NamedTemporaryFile to create a temp file that the converter can write into, and the html code can then display. The problem is how to deal with removing the temp file. I would like to not clutter up the server with temp files, and no matter what i do, i can't seem to delete the file afterwards without causing a broken <img> link in the html page. I can turn delete=False on for the temp file and it works fine, but i would like to automatically remove the file after its been sent to the browser. Am i thinking about this in the wrong way? This is the first cgi app i've written and i'm not too familar with the practices.
smb3d 0 Newbie Poster
vidaj 35 Junior Poster in Training
smb3d 0 Newbie Poster
vidaj 35 Junior Poster in Training
smb3d 0 Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.