search
尋找貓咪~QQ 地點 桃園市桃園區 Taoyuan , Taoyuan

PHP接收通過CURL傳送的二進位(二進制)檔案 (CURL 上傳二進制檔到 PHP WEB SERVER/簡易檔案伺服器) – jashliao部落格

PHP接收通過CURL傳送的二進位(二進制)檔案 (CURL 上傳二進制檔到 PHP WEB SERVER/簡易檔案伺服器)


資料來源: https://www.796t.com/post/ZDlwdWk=.html

Code:

An error occurred.";
        exit;
    }

    // ensure a safe filename
    $name = preg_replace("/[^A-Z0-9._-]/i", "_", $myFile["name"]);

    // don't overwrite an existing file
    $i = 0;
    $parts = pathinfo($name);
    while (file_exists(UPLOAD_DIR . $name)) {
        $i++;
        $name = $parts["filename"] . "-" . $i . "." . $parts["extension"];
    }

    // preserve file from temporary directory
    $success = move_uploaded_file($myFile["tmp_name"],
        UPLOAD_DIR . $name);
    if (!$success) { 
        echo "

Unable to save file.

"; exit; } // set proper permissions on the new file chmod(UPLOAD_DIR . $name, 0644); }

shell(bat): 

curl --request POST  --data-binary "@binary.jpg"  http://example.com/uploader.php



熱門推薦

本文由 jashliaoeuwordpress 提供 原文連結

寵物協尋 相信 終究能找到回家的路
寫了7763篇文章,獲得2次喜歡
留言回覆
回覆
精彩推薦