dimanche 3 juillet 2016

php imorting file keeps searching on the server

Im having an issue import a .csv file into a php script to add to a mysql server, im local hosting the server and when i test the script the output error says file location does not exist because its searching for the file where the website is stored and not on my desktop where the file actually is. <form id="import" action="edit.php" method="post" enctype="multipart/form-data"> Select BOM .csv file to upload: <input name="file" type="file" required="required" id="file" form="import"> <input name="submit" type="submit" form="import" value="import"> <?php if(isset($_POST['submit'])) { $file = $_FILES['file']; $query = "LOAD DATA INFILE '$file' INTO TABLE `boards` FIELDS TERMINATED BY ',' IGNORE 1 LINES"; $Result = mysql_query($query) OR die(mysql_error()); } ?> </form> Does anyone know how to make the actual .csv file upload so I can add it to the sql database?

Aucun commentaire:

Enregistrer un commentaire