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)

List of changes I've made
I'm testing it at www.wikifs.org/Special:UploadCSV, here's a list of the changes I've made during the process of getting it to function and also some extra features:
 * (diff) Need to use $wgRequest->getFileTempname to access uploaded data
 * (diff) Form needs enctype="multipart/form-data" for data to be uploaded
 * (diff) File reads were reading 4096 bytes, changed from fgets to fscanf to read one text-line at a time (not quite working yet)
 * (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
 * (diff) Simplified main work loop: LoadTemplate seems redundant.
 * (diff) Changed back to fgets, omitting second parameter reads a single line (since PHP4.3)

Problems

 * Uploaded files are never deleted currently - maybe add an expiry time?

Error: File not found.

 * Hi GunterS
 * When I used this extension I got a massage "Error: File not found.". But I had checked some things as followed.
 * Setting Localsetting.php with

$wgEnableUploads = true; $wgFileExtensions = array( 'png', 'gif', 'jpg', 'jpeg', 'mpg', 'mm', 'doc', 'txt', 'csv' );
 * The name of template( To confirm the template name such as "classmate" and "template:classmate").
 * The location of .csv file (such as C:\classmate.csv).
 * changing the interface of Mediawiki from Zh-tw to En(English).
 * But it still didn't work. Are there anythings that I hadn't tryed? Please give me a hand.

Roc michael 15:38, 22 June 2007 (UTC)
 * 1) Win XP
 * 2) MediaWiki: 1.9.3
 * 3) The AppServ Open Project - 2.5.7 for Windows
 * 4) * Apache Web Server Version 2.2.3
 * 5) * PHP Script Language Version 5.1.6
 * 6) * MySQL Database Version 5.0.24a