php Datei-upload move_uploaded_file() Failed to open stream

Habe ich ein Datei-upload-Skript:

$allowedExts = array("gif", "jpeg", "jpg", "png");
$extension = end(explode(".", $_FILES["picture"]["name"]));
if ((($_FILES["picture"]["type"] == "image/gif") || ($_FILES["picture"]["type"] == "image/jpeg") || ($_FILES["picture"]["type"] == "image/jpg") || ($_FILES["picture"]["type"] == "image/png")) && in_array($extension, $allowedExts)):
    if($_FILES["picture"]["error"] > 0):
        echo "Error: " . $_Files["picture"]["error"];
    else:
        move_uploaded_file($_FILES["picture"]["tmp_name"], "/TnA/ProfilePics/" . $_SESSION['ID'] . "." . $extension);
    endif;
endif;

Aber ich bin immer der Fehler:

Warning: move_uploaded_file(TnA/ProfilePics/1.jpg) [function.move-uploaded-file]: failed to open stream: No such file or directory in /home/content/91/9848191/html/TnA/webservice.php on line 1067

Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/php5nOdhI' to 'TnA/ProfilePics/1.jpg' in /home/content/91/9848191/html/TnA/webservice.php on line 1067

Hier ist meine Datei-Struktur:

Web Host Root (I have another site here)
    -TnA (Root of this site)
        -index.html
        -webservice.php
        -ProfilePics
            -(My target location)

Was relative Verzeichnis-url sollte ich verwenden? Ich habe versucht ProfilePics/1.jpg und /ProfilePics/1.jpg beide bringen den gleichen Fehler.

EDIT:

Mit:

move_uploaded_file($_FILES["picture"]["tmp_name"], dirname(__FILE__) . "ProfilePics/" . $_SESSION['ID'] . "." . $extension);

Bekomme ich:

Warning: move_uploaded_file(/home/content/91/9848191/html/TnA/ProfilePics/1.jpg) [function.move-uploaded-file]: failed to open stream: No such file or directory in /home/content/91/9848191/html/TnA/webservice.php on line 1067
InformationsquelleAutor SnareChops | 2013-03-19
Schreibe einen Kommentar