Reading local files

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
marnieg
Forum Commoner
Posts: 65
Joined: Wed Mar 12, 2003 4:35 pm

Reading local files

Post by marnieg »

I have a website where I want to prompt the user to select multiple files to be read which the code will then upload data into my MySQL database.

Is it possible to prompt them for multiple files or do I have to do them individually?
Currently the files are dbf files and I was going to use dbase_open function, but I don't think my hosting company (GoDaddy) allows that function. When I did the phpinfo page I don't see 'enable-dbase'. Can I only read like csv files from my local machine? Or do I need to load them to my hosting server first and then process them?

One of the files is over 50MB and concerned about how long to process. Has anyone had any problems loading this much data at one time from a file?

What is the best functions to use to read and insert the data?

Thanks for any help or links to scripts you can provide.
M
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Reading local files

Post by Christopher »

marnieg wrote:Is it possible to prompt them for multiple files or do I have to do them individually?
Yes, it is a browser function -- see docs for input type=file.
marnieg wrote:Currently the files are dbf files and I was going to use dbase_open function, but I don't think my hosting company (GoDaddy) allows that function. When I did the phpinfo page I don't see 'enable-dbase'. Can I only read like csv files from my local machine? Or do I need to load them to my hosting server first and then process them?
You need to call your hosting company.
marnieg wrote:What is the best functions to use to read and insert the data?
fopen() and fread() are the most basic. There are also functions like file_get_contents(), etc. See the PHP docs for Filesystem functions.
(#10850)
Post Reply