Nasty but gets it done:
$delim = ','; $enc = '"'; $line = "\n";
foreach( str_getcsv ( file_get_contents( $tmpname ), $line ) as $row ) $csv = str_getcsv( $row, $delim, $enc ); // print_r( $csv );
or, if you want to be even more crazy, in 1 (note, config options are inline but I left the assignments so they are findable):
foreach( str_getcsv ( file_get_contents( $tmpname ), $line = "\n" ) as $row ) $csv = str_getcsv( $row, $delim = ',', $enc = '"' ); // print_r( $csv );
or, if you want it to be one expression, but more readable:
str_getcsv ( file_get_contents( $tmpname ), $line = "\n" )
$csv = str_getcsv( $row, $delim = ',', $enc = '"' );
// print_r( $csv );
In the examples above, I’m assuming you already know the temporary name of the uploaded file. In regular PHP, you could prepend this code with
$tmpname = $_FILES[tmp_name];
In CakePHP, you might just replace $tmpname with $this->data[‘Whatever’][‘csv’][‘tmp_name’];
This kind of assumes you had done something like this on the form page:
echo $this->Form->create('Whatever', array('type' => 'file'));
I’ve fixed most of the major bugs, and moved a few ideas I had to the next release wish list. As a final step, I must complete the help files. I plan to take care of that over the weekend and release a working copy within the next week.
Here’s the current bug list for Mango that I’ll be working on over the next week or two. After this list is complete, the initial release will go online. Nightly backups of data will be required just in case I miss something which causes the database to become corrupted.
double what do i do? fixed
auto focus fixed
registration is stupid if it works fixed
after reg, auto login the user fixed
pressing enter is no work in form fixed
show me that i logged in fixed
show me that i logged out fixed
New Document link should be removed
feature request: search next version
powered by link goes nowhere
add spacing to title fixed
upload ten files, click save. expectation: files are added to revision. actually: files are saved to document, must be manually attached to revision. fixed
manually attaching files doesn’t seem to work fixed
it would be nice to allow chronological sorting as well next version
seek an anchor based on action (index/add/view) next version
pages that need help fixed
- all pages
- become an author
redirect this page to the edit page. who the hell needs to see this? move the updated and joined dates over to the edit page as information. fixed
remove roles from page if not admin fixed
double what do i do fixed
Submit button should say “Save” fixed
save should save, then go back to editing page with a message that things were saved fixed
feature request: add button for “pages i’ve edited” next version
lock down to admin permissions fixed
creating a new page (at least by going to the url) doesn’t seem to work fixed
The Mango Initial Release is drawing near. I’ve resumed work on the project I was getting all fired up about last year – thanks to my wife – and it’s looking really good.
A few things about the plan have changed, however. First, I decided that for now, I’m just targeting me as an audience for this thing. Trying to program it in a way that would work for the whole world was stressing me out and slowing down development. My wife snapped me out of a funk one night when I was lamenting my predicament by asking, ‘Why don’t you just make it for you and don’t worry about selling it?’
It was the best advice I ever listened to – it made me remember why I started this. I suddenly knew the direction I wanted to go in. I got my spark back.
This doesn’t mean that Mango is dead or anything. I’m still going to release it to the public under one of the open source licenses, but whether or not I try to turn it into a money making adventure remains a question that I’m not too concerned with right now. Right now I’m excited because I’ve got the following features in there now:
- WYSIWYG editor – TinyMCE
- Multiple file uploads with progress bars for each file – SWFUpload
- Multimedia attachment to Pages – Anarchy Web Player (not sure if I’m staying with this or if I will roll my own)
- Full YAHOO UI integration for a great look and feel and intuitive, responsive interfaces.
- A basic authentication system
- All the usual stuff that wikis have.
I still need to have a search feature, but I might leave that for the second realease. Mostly, I’m trying to concentrate on the most important part: making editing pages easy and fun. I need to run through things tomorrow and figure out what needs to be locked down better. I’m sure I’ve got security holes in it right now. once I plug those, I’ll put it online and start checking in new versions periodically as I reach stable milestones.
It feels really good to be working on this right now. My wife has been very supportive, which helps a lot. Almost every day I come home, put down my stuff, crack open the laptop, and start hammering away at it. I’ve even gotten the alias ‘Wiki-man’ recently.
This weekend, I’m hoping to release a beta of a wiki system I’m developing called ‘Mango.’� My intention is to start off with some basic wiki functionality, get some testers, revise, then produce a version 1 release which will be available for free download on the web.
Ultimately, I would like to do a full product launch a month or two from now which includes a boxed version of this software.� The commercial, packaged version will include the Mango software, printed and digital user manual, and video tutorial cd-rom and/or dvd.
I will be hosting a live version of Mango at http://mango-demo.revillini.com.
I will also host my family wiki using Mango at http://family.revillini.com – this was the original intent of the software, even though it does not yet have any geneology-specific features at this time.