Welcome Guest, Not a member yet? Register   Sign In
Upload csv file straight into array
#1

[eluser]johnwbaxter[/eluser]
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?
#2

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

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




Theme © iAndrew 2016 - Forum software by © MyBB