• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Upload csv file straight into array

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?

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.

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

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.