CodeIgniter Forums

Full Version: Upload csv file straight into array
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

I need to upload a csv file and then use the (single column of data) in an array and then in a query.

How can i do this without first saving the file? I'm sure it's something really simple but i just can't find anything on how i might go about this.

Any ideas anyone?

El Forum

If you upload the file it's saved as a temp file. You can get the content by using
$temp_csv = $_FILES['userfile']['tmp_name'];
$content = file_get_contents($temp_csv);
What the upload library does additionally is move the file to the destination directory.

El Forum

How funny, that really is something i should have known. Thanks xwero, i quite often find silly blanks in my knowledge...