我试图通过PHP上传捕获的图像从Android设备到远程服务器 - ftp_put() 功能 . Android代码正在运行,我只是从php端无法使用它 .

说明:在Android / Java端,我将位图编码为字符串并在PHP中解码($ binary) . 我想将此位图上传到远程服务器 . 请参阅我的PHP代码:

<?php

if ($tag == 'upload') {

        //Get data from client
        $uid = $_POST['uid'];
        $base = $_POST["image"];
        $date = date('Y-m-d-H-m-s');

        if (isset($base)) {
            //function creates random numbers and stores in $suffix
            $suffix = $db->createRandomID(); 

            //Prepare image name
            $image_name_ = "img_".$suffix."".$uid."_".date("Y-m-d-H-m-s").".jpg";

            // base64 encoded utf-8 string
            $binary = base64_decode($base);

            // binary, utf-8 bytes
            header("Content-Type: bitmap; charset=utf-8");

            //Basic ftp information
            $ftp_server = "xxx.xxx.com";
            $ftp_user_name = "xxxxx";
            $ftp_user_pass = "xxxxx";
            $file = $binary;
            $remote_file = "/public_html/uploads/".$image_name_;

            // set up basic connection
            $conn_id = ftp_connect($ftp_server);

            // login with username and password
            $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);

            // upload a file
            if (ftp_put($conn_id, $remote_file, $file, FTP_ASCII)) {
            $response["success"] = "Upload";
            echo json_encode($response);

            } else {
            $response["error"] = "failed";
            }

            // close the connection
            ftp_close($conn_id);
        }
?>

LogCat说:没有这样的文件或目录...行 if (ftp_put($conn_id, $remote_file, $file, FTP_ASCII))