Basically, I need a way to upload a CSV file and save it into a multidimensional array as the title says.
I have searched far and wide online, and I found a jQuery-csv add on here: https://github.com/evanplaice/jquery-csv
That jQuery library can handle converting the CSV file into a multidimensional array, although it is the upload part I am having real trouble with.
I am having difficulty on how to interact PHP and jQuery together. I know for a fact that PHP is always called first at the server, then jQuery/Javascript at the client side. Therefore, I am very confused on how to allow a used to upload a CSV file via PHP, save the location, pass it to jQuery, and then save it there.
I am sure this is most probably a simple task, although I could not find my answer anywhere.
So here is how I would like to do it:
- Upload the file with PHP
- Save the CSV into a string with either PHP or jQuery
- Parse the CSV into a a multidimensional array using
$.csv.toArrays(csv);
from jQuery-csv add on
All help and suggestions is greatly appreciated, thanks!