copy function

Discussion in 'PHP' started by dizyn, Nov 18, 2007.

  1. #1
    Hi

    Please see:
    copy("tmp_file.txt","home/my_file.txt");
    PHP:
    This is the error i am getting:

    Warning: copy(tmp_file.txt) [function.copy]: failed to open stream: No such file or directory in C:\wamp\www\youtube\popular.php on line 2

    any help
     
    dizyn, Nov 18, 2007 IP
  2. matthewrobertbell

    matthewrobertbell Peon

    Messages:
    781
    Likes Received:
    35
    Best Answers:
    0
    Trophy Points:
    0
    #2
    it seems tmp_file.txt does not exist, or you don't have permission to read it.
     
    matthewrobertbell, Nov 18, 2007 IP
  3. jhd

    jhd Peon

    Messages:
    612
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #3
    It s recommanded to use full path like /var/www/website/path/to.file.txt
     
    jhd, Nov 18, 2007 IP
  4. tonybogs

    tonybogs Peon

    Messages:
    462
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Yes definitely add the full path.

    Make sure the files are actually inside the same directory your script is running. You'll also need to put a/ infront of home

    /home/

    Or else itll look for a sub directory in your current directory called home
     
    tonybogs, Nov 20, 2007 IP
  5. ehlokoen

    ehlokoen Peon

    Messages:
    161
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #5
    (Hey buddies, he's using windows. What you guys suggest is UNIX ;))
     
    ehlokoen, Nov 20, 2007 IP