linux curl 上传文件

1. 服务器端程序 up.php

';
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
    echo "File is valid, and was successfully uploaded.\n";
} else {
    echo "Possible file upload attack!\n";
}

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

你可能感兴趣的:(PHP,文章)