uploading a file onto an ftp site

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • -Jim

    uploading a file onto an ftp site

    I've been looking for a solution for this for a bit... I decided to
    just try and copy and paste the solution from php.net to try and still
    nothing.

    //theUpload.php
    <?php

    echo"<form enctype=\"multi part/form-data\" action=\"result .php\"
    method=\"post\" >";
    echo" <input type=\"hidden\" name=\"MAX_FILE _SIZE\"
    value=\"3000000 0\" />";
    echo" Send this file: <input name=\"userfile \" type=\"file\" />";
    echo" <input type=\"submit\" value=\"Send File\" />";
    echo"</form>";
    ?>

    //result.php
    <?php
    $uploaddir = 'Products_image s/';
    $uploadfile = $uploaddir . $_FILES['userfile']['name'];

    print "<pre>";
    if (move_uploaded_ file($_FILES['userfile']['tmp_name'], $uploadfile))
    {
    print "File is valid, and was successfully uploaded. ";
    print "Here's some more debugging info:\n";
    print_r($_FILES );
    } else {
    print "Possible file upload attack! Here's some debugging
    info:\n";
    print_r($_FILES );
    }
    print "</pre>";
    ?>

    this results in the following errors....

    Warning: move_uploaded_f ile(Products_im ages/aPicture.bmp): failed to
    open stream: Permission denied in /home/blah/public_html/result.php on
    line 11

    Warning: move_uploaded_f ile(): Unable to move '/tmp/phpDDU9vj' to
    'Products_image s/aPicture.bmp' in /home/blah/public_html/result.php on
    line 11
    Possible file upload attack! Here's some debugging info:
    Array
    (
    [userfile] => Array
    (
    [name] => aPicture.bmp
    [type] => image/bmp
    [tmp_name] => /tmp/phpDDU9vj
    [error] => 0
    [size] => 230454
    )

    )

    I tried setting the permissions of the Product_images folder to write
    for owner and world.. then i tried to do the same for public_html with
    no avail.

    Any suggestions??
    -Jim
Working...