PDA

Click to See Complete Forum and Search --> : Tmpfile directory


TheGoldenShogun
May 1st, 2003, 08:50 AM
ok I did this.

$my_temp_file = tmpfile();
ftp_fget($ftp_stream, $tmp_file, $todays_filename, FTP_ASCII);

basically what im trying to do is go to an FTP site where we upload things daily and check whether that file for today is there. if so I'm reading it into a tmpfile, from there I want to take the stuff from that tmpfile and append it to the file i'm about to upload.

I hope that makes sense, basically I'm running into an error here.

$dumped_info = fread($tmp_file, filesize($tmp_file));

the problem is that in order to read the tmp_file I need to specify how much of it I want to ready (the second parameter of fread). most of the times I just do a filesize($filename) thing for the second parameter but the $tmp_file is a resource, how can I get the string path of that temp file so I can supply it into my filesize function?

Thanks
:cool:

phpman
May 5th, 2003, 02:03 PM
you will have to load the file in question to a different variable I think.

or just give it a specific number like 2024

also just noticed. ftp_fget is the same as fopen isn't it? I mean it opens it and writes it to the given file pointer. so if you set it to a variable it should be the same. also why couldn't you just use fopen?

TheGoldenShogun
May 5th, 2003, 04:04 PM
shoot, you're absolutely right. I didnt even think about the fact that it write to a file pointer and to just... man that counts as a botch against me. I was going crazy trying to figure it out because I had a certain way thought out in my head and I wasn't looking for an easy way. Good call phpman, that makes it easier than using temp files left and right and trying to do stuff to those.

Thanks