Directory shortcuts don't seem to work.

Discussion in 'PHP' started by yes9111, Apr 3, 2007.

  1. #1
    I'm using wamp and I'm running a php script in the url
    http://localhost/stuff/stuff2/script.php
    and in the computer, it would be C:/wamp/www/stuff/stuff2/script.php

    The move_uploaded_file(from, to) doesn't seem to work.
    the from argument is ok, but the TO argument seems to be causing problems.

    How would I get from
    http://localhost/stuff/stuff2/script.php -> http://localhost/stuff/e/a/img.jpg

    would this work for the TO argument?
    '/stuff/e/a/img.jpg'? It gives me this error.


    Warning: move_uploaded_file(/stuff/e/a/img.JPG) [function.move-uploaded-file]: failed to open stream: No such file or directory in C:\wamp\www\stuff\stuff2\script.php on line 62

    Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move 'c:/wamp/tmp\php2E.tmp' to '/stuff/e/a/img.JPG' in C:\wamp\www\stuff\stuff2\script.php on line 62
    Failed to upload the file.


    The script then works again with '../e/a/img.JPG'. But I'm trying to get it working without the '..'
    Any help?
     
    yes9111, Apr 3, 2007 IP
  2. KlearConcepts

    KlearConcepts Peon

    Messages:
    349
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Hey there,

    I see what you are trying to do in this script, have you tried using copy?

    Also, The reason that you have to have ../ is because you are moving back a directory which would need the ../ unless you set some sort of home directory as a session or variable, I don't know how you can get round it.

    Steven
     
    KlearConcepts, Apr 4, 2007 IP