For input you could save the files temporary as upload files,

or without saving them you can use HTML5 javascript FileReader and save the 
file content to hidden <input>s.
No idea if web2py will upload something based on file handlers from 
SQLFORM.factory with upload fields.
If so, you will upload it twice (from hidden fields and as standard 
upload), and so you could re-create both file <input>s before the submit 
via javascript DOM manipulation (because it is not possible set the value 
of upload field from javascript, nor clear it: the 1-st is clever, but the 
2nd stupid :( )

For output you could
- return the resulting file content as string from the controller (I hope 
web2py makes nothing with string output),
- and change http headers for download (Content-Disposition or so) to force 
Save dialog.

Maybe somebody has much much better answer, but previous is not too 
difficult, few lines of code for FileReader. FileReader is supported in 
modern browsers but not IE8. (IE9?)




Dne pondělí 2. května 2016 4:34:40 UTC+2 teld dlet napsal(a):
>
> I have a python program where I prompt the user for two files, and I do 
> some programming and output a new file...
>
> How can I make this work with web2py?
>
>
> I was thinking having a form with 2 upload fields, and a text field so 
> they can give a name to the file that will be generated from the code. 
> After form submission I access the two uploaded files from form.vars and do 
> what needs to be done, then not sure how I would output a downloadable file 
> for the user?
>
> None of these files need to be saved in the database for later retrieval 
> so not sure if I should just use sqlformfactory, this is all something that 
> would happen during their session and they can choose to save the new file 
> to their computer. 
>
>
>
> Any advice will help, thank you
>
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to