Uploaded File Interaction
I'm doing a ZClass based product and want to change some lines in a uploaded file.... How can I interact with this file and see their content? <dtml-var "REQUEST.form['attched_file']"> doesnt work.... any ideias? I want to do something like while <FILE>: in perl.... Thanks! -- Diego Rodrigo Neufert Webmaster / Web Developer - Magic Web Design ----------------------------------------------------------- diego@magicwebdesign.com.br www.magicwebdesign.com.br Curitiba - PR - Brasil
I have found how.... <dtml-in "_.string.split(test_file.read(),'\n')"> <dtml-var sequence-item> </dtml-in> On Wednesday 17 January 2001 04:44 pm, Diego Rodrigo Neufert wrote:
I'm doing a ZClass based product and want to change some lines in a uploaded file.... How can I interact with this file and see their content? <dtml-var "REQUEST.form['attched_file']"> doesnt work.... any ideias? I want to do something like while <FILE>: in perl....
Thanks!
-- Diego Rodrigo Neufert Webmaster / Web Developer - Magic Web Design ----------------------------------------------------------- diego@magicwebdesign.com.br www.magicwebdesign.com.br Curitiba - PR - Brasil
I have found how....
<dtml-in "_.string.split(test_file.read(),'\n')"> <dtml-var sequence-item> </dtml-in>
That might get quite slow for really big files. If you're using 2.3b1, you could probably do better with a Python Script to play with the file in place. IIUC, test_file above, and REQUEST['test_file'], should be the same thing and can both be played with like normal python file objects. That might be a more efficient way to do what you want if you're actually changing lines, but I may be misunderstanding, and FileUpload objects may not play like file objects either... ...it's late here, sorry ;-) Chris
participants (2)
-
Chris Withers -
Diego Rodrigo Neufert