Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/api/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
ColdFusion 2018 REST API文件上载,包含多部分/表单数据_Rest_Api_Coldfusion_Postman_Coldfusion 2018 - Fatal编程技术网

ColdFusion 2018 REST API文件上载,包含多部分/表单数据

ColdFusion 2018 REST API文件上载,包含多部分/表单数据,rest,api,coldfusion,postman,coldfusion-2018,Rest,Api,Coldfusion,Postman,Coldfusion 2018,如何在ColdFusion 2018 REST服务中使用enctype=“multipart/form data”上传文件 模拟一个简单的服务 <cfcomponent rest="true" restpath="file"> <cffunction name="postUpload" restpath="upload" access="remote" returntype="struct" httpmethod="POST" produces="application

如何在ColdFusion 2018 REST服务中使用enctype=“multipart/form data”上传文件

模拟一个简单的服务

<cfcomponent rest="true" restpath="file">

   <cffunction name="postUpload" restpath="upload" access="remote" returntype="struct" httpmethod="POST" produces="application/json">

       <cfset var response = {} />  

       <cffile 
          action = "upload"
          filefield = "file"
          destination = "D:\files\temp\"
          accept = "application/pdf"
          nameConflict = "overwrite"
          result="myFile"
        >

        <cfset response = myFile />

        <cfreturn response>
   </cffunction>

</cfcomponent>
回应 我已经尝试了没有上传文件的身体部分,它给出了

The form field file did not contain a file. (Error in ColdFusion log file)

{
  "message": "Internal Server Error",
  "success": false,
  "errcode": "500"
}
我的问题是,为什么在我上传文件时会出现404错误

 {
   "message": "Not Found",
   "success": false,
   "errcode": "404"
 }
The form field file did not contain a file. (Error in ColdFusion log file)

{
  "message": "Internal Server Error",
  "success": false,
  "errcode": "500"
}