Results 1 to 3 of 3

Thread: Tmpfile directory

  1. #1

    Thread Starter
    Addicted Member TheGoldenShogun's Avatar
    Join Date
    Mar 2001
    Location
    VA/MD... anywhere around the beltway
    Posts
    236

    Unhappy Tmpfile directory

    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

  2. #2
    Frenzied Member
    Join Date
    Nov 1999
    Posts
    1,337
    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?
    Last edited by phpman; May 5th, 2003 at 02:08 PM.

  3. #3

    Thread Starter
    Addicted Member TheGoldenShogun's Avatar
    Join Date
    Mar 2001
    Location
    VA/MD... anywhere around the beltway
    Posts
    236
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width