Forum Moderators: coopster

Message Too Old, No Replies

want to read in a 20mb .txt

         

proxyHunter

12:04 am on Feb 4, 2004 (gmt 0)

10+ Year Member



im having trouble reading in a 20mb .txt file into a php script.

is ther some code workaround to buffer the data in?

mykel79

10:41 am on Feb 4, 2004 (gmt 0)

10+ Year Member



I would think most servers have a limit set and won't let php use that much memory for one script.
But do you need the text in a variable to work on? If you just want to show it on the page the why not just read it line by line and echo it to the screen.
If you need it in a variable, then...you'll have to wait for some other replies :)

jatar_k

8:49 pm on Feb 4, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



20 MB is huge. How come so big?

Maybe you could explain the situation a little more and maybe we could think up a work around. Maybe splitting it into chunks?

moltar

8:55 pm on Feb 4, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



What do you mean by "read"? You cannot upload the file onto the server through php or you cannot open it localy?

WhosAWhata

10:39 pm on Feb 4, 2004 (gmt 0)

10+ Year Member



echoing one line at a time...thats an interesting idea

proxyHunter

11:31 pm on Feb 4, 2004 (gmt 0)

10+ Year Member



im using fgetcsv

and also tried using other php file functions, i think the best bet is to split the 20mbfile into a smaller file or better you import the data into a database.

i think its useless though that by default you cant have more than 16mb of data in a script,

is there a way to buffer the data in , say 1000 lines ata a time, then get the next 1000 lines

mykel79

11:10 am on Feb 5, 2004 (gmt 0)

10+ Year Member



>echoing one line at a time...thats an interesting idea
Yeah, well, I thought maybe proxyHunter just wanted to spit out the contents of the file to the screen.