1
votes

Here is my Folder's reource.

Path : /www/partner/bulk_files
Location : ftp://plus1000@exampleIP/www/plus1000/www/partner/bulk_files

I couldn't upload.

What is ploblem. T^T

$ftp_host = "exampleIP";
    $ftp_hostid = "ID";
    $ftp_hostpwd = "password";
    $connect_id =ftp_connect($ftp_host) or die("fail");

    $bulk_uploadDir = '/www/partner/bulk_files';

    $login_ftp_result = ftp_login($connect_id, $ftp_hostid, $ftp_hostpwd);

    if ((!$connect_id) || (!$login_ftp_result)) {

        echo "Ftp connection has failed!";

        echo "Attempted to connect to $ftp_host for user $ftp_hostid";

        die;

    } else {

        echo "Connected to $ftp_host, for user $ftp_hostid<br/-->";

    }

        echo "<hr>";

    if (ftp_put($connect_id, $bulk_uploadDir, $_FILES["file"]["name"], FTP_ASCII)) {
        echo "<br>Succes to upload<br>";
    } else {
        echo "<br>fail to upload<br>";
    }

Result is "Warning: ftp_put(35513.jpg): failed to open stream: No such file or directory in /www/plus1000/www/partner/bulk_update.php on line 78 " fail to upload

What is my the path?

1

1 Answers

1
votes

if your uploading a file that was just uploaded via a form post use tmp_name not name

if (ftp_put($connect_id, $bulk_uploadDir, $_FILES["file"]["tmp_name"], FTP_ASCII))

also if your uploading an image use FTP_BINARY instead of FTP_ASCII