I am working on python and biopython right now. I have a file upload form and whatever file is uploaded suppose(abc.fasta) then i want to pass same name in execute (abc.fasta) function parameter and display function parameter (abc.aln). Right now i am changing file name manually, but i want to have it automatically.
Workflow goes like this.
—-If submit is not true then display only header and form part
— if submit is true then call execute() and get file name from form input
— Then displaying result file name is same as executed file name but only change in extension
My raw code is here — http://pastebin.com/FPUgZSSe
Any suggestions, changes and algorithm is appreciated
Thanks
You need to read the uploaded file out of the cgi.FieldStorage() and save it onto the server. Ususally a temp directory (/tmp on Linux) is used for this. You should remove these files after processing or on some schedule to clean up the drive.
This modified the execute to take the path to the newly saved file.
For the result file, you could also stream it back so the user gets a “Save as…” dialog. That might be a little more usable than displaying it in HTML.