使用 curl 上传文件

 

curl -u httpuser:httppassword -F “postParameterName=value” -F “fileFieldName=@fileNameInOs” http://dev.ymeng.net/upload.php

  • -u 指定http认证用户名及密码
  • -F 指定使用HTTP multipart POST方式发送参数
  • @ 读取文件

 

php处理代码

 

< ?php
$parameterValue = $_POST['postParameterName'];
$uploadedFileName = $_FILES['fileFieldName']['name'];
$uploadedFileSize = $_FILES['fileFieldName']['size'];
 
// move_uploaded_file...
?>

发表评论

邮箱地址不会被公开。 必填项已用*标注