Many thanks, it works. ----- Puvodní zpráva ----- Od: "Peter Bengtsson" <mail@peterbe.com> How about something like: <dtml-in "PyS_csvimport(fcsv.read())" prefix="pys"> On 14 October 2011 10:29, Jaroslav Lukesh <lukesh@seznam.cz> wrote:
Hi all,
I want upload csv file for direct processing into SQL only, not for save to ZODB nor LocalFS. Upload for LocalFS already worked for me.
So I have form:
<form method="POST" enctype="multipart/form-data"> <input type="file" name="fcsv" value="" size="50"><br> <input type="file" name="fcsv2" value="" size="50"><br> <input type="submit" name="fileupload" value="Upload"> </form>
Diagnostic processing: <dtml-var "fcsv.filename">::<dtml-var "fcsv.headers['Content-Type'] ">::<dtml-var fcsv> And what it get: data_2011.CSV::application/vnd.ms-excel::
Su upload worked, but what I can access to data of the uploaded file?
the dtml-in does not process anything, only displays NO DATA.
<dtml-in "PyS_csvimport(fcsv)" prefix="pys"> <dtml-var pys_item><br> <dtml-else> NO DATA </dtml-in>
PyS_csvimport parse CSV file by line and return array structure like this [['',''],['','']].