Extension talk:UploadCSV

Excellent! How far away do you think this extension is before ready? I was about to write exactly this same functionality but thought I better check what's available ;-) I was going to use it to importing spreadsheet information with time information added using Extension:When so that DPL queries could be used to select by account and time period etc. --Nad 11:40, 1 May 2007 (UTC)
 * Could the delimeter used be a global variable instead of fixed to semicolon? --Nad 11:46, 1 May 2007 (UTC)
 * Hi Nad, actually it is working, so I will supply a link with the source code these days. --GunterS 18:00, 2 May 2007 (UTC)
 * Excellent! thanks a lot ;-) --Nad 21:49, 2 May 2007 (UTC)

File not found (fixed)
Hi, I've got the new extension installed, but it says "file not found" when I try to upload any files, do you know what might be wrong? also what's the two text boxes next to the submit button for? --Nad 06:13, 4 May 2007 (UTC)
 * I can't see in the code where its retrieving the tmp-path of the uploaded file, I added
 * $UploadFile = $wgRequest->getFileTempname('wpUploadFile');
 * before line 194 which made it work better and it processed a single line of the file correctly (It didnt work putting this change at the place that $UploadFile is first assigned). I've added it to our wiki at UploadCSV.php for now, the diff of the tmp bit I added is here --Nad 07:32, 4 May 2007 (UTC)
 * ...and also had to add enctype to form element or it doesn't upload anything --Nad 02:22, 5 May 2007 (UTC)
 * enctype="multipart/form-data">

Working for one iteration only (fixed)
I've had another look at it today to try and get it iterating through more than once, but I can't get it working. Here's the current difference from your version, it processes the first row after the upload, then keeps re-submitting indefinately but without processing any rows after the first. --Nad 11:38, 7 May 2007 (UTC)
 * I found the problem here, it was reading 4096 bytes at a time and treating them unconditionally as a single line, but my whole test file was less than 4096 bytes. I've changed the read loop to get one line at a time as follows --Nad 21:32, 7 May 2007 (UTC)
 * while ($data = fscanf($handle,"%s\n")) { ... $data = explode(';',$data[0]); ...

A few features and changes added

 * (diff) Changed the template text-input into a dropdown list of all the templates
 * (diff) Allow separator to be set in form, also allows escaping separator in content (e.g. \;).
 * I noticed the header file-read was also getting 4096 bytes, so changed to read a single line
 * I also temporarily changed the form here, but it's chanegd back again now
 * (diff) Removed the update of the client-side form info from inside main row-processing loop
 * (diff) Made loop process from start-line to end-line and then update the form ready for another block of same size
 * (diff) The tmp file needs to be moved if we want to continue processing it without re-uploading (currently the moved files are not deleted)
 * (diff) Moved upload button into second column of table