Jason
Jason

Reputation:

PHP: Process a CSV or XLS file

I need to let users pick a CSV or XLS file from their filesystem and press Submit and have PHP open it, look at it, decide if it is valid and then put the data in MySQL.

I am stuck on how the server gets the file they pick from their desktop?

Do I have to upload the file they pick to a temp directory?

Can I just take a copy and check it in memory?

Advice would be appreciated!

Upvotes: 3

Views: 1935

Answers (1)

Rob Prouse
Rob Prouse

Reputation: 22647

Read Handling File Uploads in the PHP documents. That will cover how to get it to the server. You do upload the file using a POST to a temporary directory on the server (handled fairly seamlessly for you) and then you just take the filename that it gives you and open that file.

Upvotes: 4

Related Questions