MySQL Forums :: PHP :: How insert data in table using a .txt file


Advanced Search

How insert data in table using a .txt file
Posted by: Julia Fleur ()
Date: April 05, 2010 10:41AM

How do you do this if you are uploading the .txt file in a form like this:

index.php:

<form method="post" action="process_upload.php" enctype="multipart/form-data">
<input type="file" name="filename" value="Locate File" /><br /><br />
<input type="submit" value="Submit File" />
</form>

TO

process_upload.php:

<?php

$result = MYSQL_QUERY("LOAD DATA LOCAL INFILE '$filename' INTO TABLE data LINES TERMINATED BY '\r\n'");

echo "<meta http-equiv=\"refresh\" content=\"0;URL=index.php\">";
mysql_close();


?>

^----- is not working for me, i think there's a problem with $filename part, what do I do so that it grabs the file i uploaded using the form?



Edited 1 time(s). Last edit at 04/05/2010 10:43AM by Julia Fleur.

Options: ReplyQuote


Subject Written By Posted
How insert data in table using a .txt file Julia Fleur 04/05/2010 10:41AM
Re: How insert data in table using a .txt file Ventsislav Alexandriyski 04/05/2010 03:13PM
Re: How insert data in table using a .txt file Julia Fleur 04/05/2010 04:01PM
Re: How insert data in table using a .txt file Ventsislav Alexandriyski 04/06/2010 05:00AM
Re: How insert data in table using a .txt file Julia Fleur 04/06/2010 03:53PM
Re: How insert data in table using a .txt file Ventsislav Alexandriyski 04/06/2010 04:26PM
Re: How insert data in table using a .txt file Julia Fleur 04/06/2010 04:34PM
Re: How insert data in table using a .txt file Ventsislav Alexandriyski 04/06/2010 04:55PM
Re: How insert data in table using a .txt file Julia Fleur 04/06/2010 05:12PM
Re: How insert data in table using a .txt file Ventsislav Alexandriyski 04/07/2010 04:44AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.