Upload a csv file and display in textarea.

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
voldisinarta
Forum Newbie
Posts: 1
Joined: Mon Jun 23, 2008 12:02 am

Upload a csv file and display in textarea.

Post by voldisinarta »

Hi Guys...

I've been PHPing for about a year now, but I'm new to this forum. I have a question which breaks my head these last few hours...

I want to do this steps of uploading a csv file to the database. I've done the csv upload to database before but this time with a slight tweak in the middle of the proccess. In my screen there will be 2 main part, the file upload form and the correction area form.

The steps are:
1. User select the csv file to upload. After selecting a file, user click Submit button. (<-- done, using form type="file")
2. The content of the file displayed in the textarea below it (<<------MY PROBLEM)
3. Highlighting the lines which has errors with different color (<-- no prob)
4. User will be able to correct the errors by typing directly into the textarea (<-- no prob)
5. User click the Import button to import the csv contents from the textarea to database (<-- no prob)

My Question regarding no (2):
1. How can I display the content of the uploaded file in the textarea?
2. How can I make sure that the temporary file is erased as soon as the contents are displayed on the textarea?

Thanks.
Post Reply