image help?

    Date: 11/29/05 (PHP Community)    Keywords: php

    I'm having trouble with uploading images via php.

    = "Photo Uploader";
    include (
    './header.inc.php');

    ?>

    Upload Photo
    echo $_SERVER['PHP_SELF']; ?>" method="post" tmt:validate="true">

        
            
                
                
            
            
                
                
                
            
            
                
                
            
        
    if (!empty($_POST['member_number'])) echo $_POST['member_number']; ?>"
                tmt:required="true"
                tmt:pattern="positiveinteger"
                tmt:errorclass="error"
                tmt:message="ERROR: Please enter the number number of the member photo to upload." />
                tmt:required="true"
                tmt:errorclass="error"
                tmt:message="ERROR: Please select an image to upload.
                Maximum File Size: 1048576 bytes (1 MB)" />







    if (isset($_POST['submitflag'])) {
        foreach (
    $_POST as $key => $value) {
            echo
    "$key = $value
    "
    ;
        }
        echo
    '

    '
    ;
    }

    if (isset(
    $_POST['submitflag'])) {
        foreach (
    $_FILES['photo'] as $key => $value) {
            echo
    "$key = $value
    "
    ;
        }
        echo
    '

    '
    ;
    }


    // Move the uploaded file to the Member Photos Directory.
    $uploaddir = 'D:\\TravelNet\\Member%20Photos\\';
    $uploadfile = $uploaddir . basename($_FILES['photo']['name']);

    echo
    '
    ';
    if (
    move_uploaded_file($_FILES['photo']['tmp_name'], $uploadfile)) {
       echo
    "File is valid, and was successfully uploaded.;
    } else {
       echo
    "Possible file upload attack!;
    }

    echo
    'Here is some more debugging info:';
    print_r($_FILES);

    print
    "
    "
    ;

    ?>

    include('./footer.inc.php'); ?>


    And here's the output from the post and the files array...

    member_number = 295400
    MAX_FILE_SIZE = 1048576
    submitflag = Submit
    name = Feeling-Blue.jpg
    type = image/jpeg
    tmp_name = C:\PHP\uploadtemp\php177A.tmp
    error = 0
    size = 22304

    Warning: move_uploaded_file(D:\TravelNet\Member%20Photos\Feeling-Blue.jpg) [function.move-uploaded-file]: failed to open stream: No such file or directory in G:\Special\Intranet\dev\ulphoto.php on line 74

    Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move 'C:\PHP\uploadtemp\php177A.tmp' to 'D:\TravelNet\Member%20Photos\Feeling-Blue.jpg' in G:\Special\Intranet\dev\ulphoto.php on line 74

    Possible file upload attack!
    Here is some more debugging info:Array
    (
        [photo] => Array
            (
                [name] => Feeling-Blue.jpg
                [type] => image/jpeg
                [tmp_name] => C:\PHP\uploadtemp\php177A.tmp
                [error] => 0
                [size] => 22304
            )

    )


    Any help you guys can provide would be appreciated.

    Source: http://www.livejournal.com/community/php/371253.html

« Undesireable sticky form || Help :/ »


antivirus | apache | asp | blogging | browser | bugtracking | cms | crm | css | database | ebay | ecommerce | google | hosting | html | java | jsp | linux | microsoft | mysql | offshore | offshoring | oscommerce | php | postgresql | programming | rss | security | seo | shopping | software | spam | spyware | sql | technology | templates | tracker | virus | web | xml | yahoo | home