Re: Import from csv file to MySQL
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.php archive

Re: Import from csv file to MySQL

From: chrislive <chrislive@gmail.com>
Date: Wed Sep 21 2005 - 05:38:51 CEST

I am at work so I cant give you the code but what you need to do is the
following:

1. upload to a temporary directory (say /temp - this folder will need
to have appropriate access rights)

2. use the file_read funcions (look for tutorials on flat files for all
this)

3. import your data into the DB

4. If successful use unlink($file); to delete OR print error message

Thanks
Chris

Smitro wrote:
> Hi,
>
> I'm in the middle of writing a script to import a csv file into mySQL
> (as apart of a bigger project)
>
> I need to know what are the best steps to go from $_FILES to file().
>
> Once the file is read into an array I should be right. I don't want to
> keep a copy of the file uploaded either, as once it is imported I will
> have no use for it.
>
> I'm not sure, do I copy it store it then use it or is there a faster
> way? Will the temp file be deleted or do I have to delete it?
Received on Tue Oct 18 02:26:20 2005