jeeves245 Posted August 5, 2009 Share Posted August 5, 2009 Hey guys, another question I currently use this code to open a CSV file (from a folder on the server) and insert it into a database: $file_handle = fopen("file.csv", "rb"); while (!feof($file_handle) ) { $line_of_text = fgets($file_handle); $parts = explode(',', $line_of_text); Then the SQL querys come after that. How hard would it be to modify that to upload the CSV file using a form? (I.e. browse to the file on the computer and submit it). I don't want the whole file just to be chucked in the database though, I need the code to save pieces into an array like the above code does. I've done a lot of research on Google but most pre-made scripts are too complex for my needs. Would this be hard to do? Thanks in advance. Link to comment https://forums.phpfreaks.com/topic/168889-solved-uploading-csv-file-to-mysql-database/ Share on other sites More sharing options...
abazoskib Posted August 5, 2009 Share Posted August 5, 2009 no it is not hard. http://www.tizag.com/phpT/fileupload.php Link to comment https://forums.phpfreaks.com/topic/168889-solved-uploading-csv-file-to-mysql-database/#findComment-891097 Share on other sites More sharing options...
jeeves245 Posted August 9, 2009 Author Share Posted August 9, 2009 Thanks for the link.. will have a look. Link to comment https://forums.phpfreaks.com/topic/168889-solved-uploading-csv-file-to-mysql-database/#findComment-893862 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.