linux curlアップロードファイル

821 ワード

1.サーバ側プログラムup.php
';
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
    echo "File is valid, and was successfully uploaded.
"; } else { echo "Possible file upload attack!
"; } echo 'Here is some more debugging info:'; print_r($_FILES); print "
";
?>
添付:上記のコードをwebサーバの下にアップロード
2.linuxでcurlを使用してファイルをアップロードする
# curl --form "userfile=@/Users/username/Downloads/20170502.zip" http://youip/up.php
     
#curl -F "userfile=@/Users/username/Downloads/20170502.zip" http://youip/up.php