C/C++/VB/MFC/Qt/C# 使用 命令模式(curl) 把檔案透過 PHP 上傳到 WEB SERVER
C/C++/VB/MFC/Qt/C# 使用 命令模式(curl) 把檔案透過 PHP 上傳到 WEB SERVER
資料來源:http://www.cppblog.com/TianShiDeBaiGu/archive/2013/09/05/203025.html
PHP:
<?php $uploads_dir = ‘./files’; //Directory to save the file that comes from client application. if ($_FILES[“file”][“error”] == UPLOAD_ERR_OK) { $tmp_name = $_FILES[“file”][“tmp_name”]; $name = $_FILES[“file”][“name”]; move_uploaded_file($tmp_name, “$uploads_dir/$name”); } ?> |
CURL Command Line:
curl.exe -F “action=uploadloadfile_for_cs.php” -F “method=post” -F “file=@c:\\debug.txt” http://127.0.0.1:8080/uploadloadfile_for_cs/uploadloadfile_for_cs.php |