Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/256.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/azure/12.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
Javascript 我想将带有一些对象(图像)的数据发布到我的php中_Javascript_Php_Html - Fatal编程技术网

Javascript 我想将带有一些对象(图像)的数据发布到我的php中

Javascript 我想将带有一些对象(图像)的数据发布到我的php中,javascript,php,html,Javascript,Php,Html,这是我的密码。所有这些数据都是正常的(json),但文件都是对象(图像),我需要将它们发布到我的php中,但当我尝试提交以下内容时,我得到了错误的响应(文件被接受,但json数据丢失) })) 是否尝试将图像转换为base64字符串并发送到服务器?然后可以在php中解码base64字符串并将其保存到文件中 请尽量用更一般的方式描述您的问题。我认为您缺少数据类型键 jQuery.ajax({ url: "/get_save_motor_quote.php", type: "POST

这是我的密码。所有这些数据都是正常的(json),但文件都是对象(图像),我需要将它们发布到我的php中,但当我尝试提交以下内容时,我得到了错误的响应(文件被接受,但json数据丢失)


}))

是否尝试将图像转换为base64字符串并发送到服务器?然后可以在php中解码base64字符串并将其保存到文件中


请尽量用更一般的方式描述您的问题。

我认为您缺少数据类型键

jQuery.ajax({
    url: "/get_save_motor_quote.php",
    type: "POST",
    dataType: "json",
    data:{ 
     policyStartDate : policyStartDate,
     noYearLicense : regNo ,
     regNo : regNo ,
     chassisNo : chassisNo ,
     vehicleType : vehicleType ,
     bodyType : bodyType,
     make : make,
     modelType : modelType,
     model : model,
     ccHp : ccHp,
     cylindersNo : cylindersNo,
     seatingNo : seatingNo,
     regMonth : regMonth,
     vehicleReplacmentDays : vehicleReplacmentDays,
     vehicleValue : vehicleValue,
     ncb : ncb,
     coverCode: coverCode,
     cpr: cpr,
     addCover: addCover,
     saveQuote : saveQuote,
     premium : premium,            
     file_ncb : file_ncb,
     file_cpr : file_CPRFront,
     file_cpr_back : file_CPRBack,
     file_license : file_LicenseFront,
     file_license_back : file_LicenseBack,
     file_vehicle : file_vocF,
     file_vehicle_back : file_vocB,
     file_last_insurance : file_insCard,

  },
    processData: false,
    contentType: false,
    success: function (res) {
      alert(res);
    },
  error: function(res){
    alert(res);
  }
});
jQuery.ajax({
    url: "/get_save_motor_quote.php",
    type: "POST",
    dataType: "json",
    data:{ 
     policyStartDate : policyStartDate,
     noYearLicense : regNo ,
     regNo : regNo ,
     chassisNo : chassisNo ,
     vehicleType : vehicleType ,
     bodyType : bodyType,
     make : make,
     modelType : modelType,
     model : model,
     ccHp : ccHp,
     cylindersNo : cylindersNo,
     seatingNo : seatingNo,
     regMonth : regMonth,
     vehicleReplacmentDays : vehicleReplacmentDays,
     vehicleValue : vehicleValue,
     ncb : ncb,
     coverCode: coverCode,
     cpr: cpr,
     addCover: addCover,
     saveQuote : saveQuote,
     premium : premium,            
     file_ncb : file_ncb,
     file_cpr : file_CPRFront,
     file_cpr_back : file_CPRBack,
     file_license : file_LicenseFront,
     file_license_back : file_LicenseBack,
     file_vehicle : file_vocF,
     file_vehicle_back : file_vocB,
     file_last_insurance : file_insCard,

  },
    processData: false,
    contentType: false,
    success: function (res) {
      alert(res);
    },
  error: function(res){
    alert(res);
  }
});