我正在尝试使用XMLHTTPRequest上传文件,并发送此标头:
Content-Type:multipart/form-data, boundary=xxxxxxxxx
--xxxxxxxxx
Content-Disposition: form-data; name='uploadfile'; filename='123_logo.jpg'
Content-Transfer-Encoding: base64
Content-Type: image/jpeg
/*base64data*/
Run Code Online (Sandbox Code Playgroud)
但是在服务器端PHP忽略标题"Content-Transfer-Encoding:base64"并将base64未解码的数据直接写入文件!
有没有办法解决它?
ps使用base64发送数据非常重要
var foo=[0];
if(foo) alert('first');
if(foo==true) alert('second');
Run Code Online (Sandbox Code Playgroud)
请告诉我,为什么第二个警报不起作用?在第一次警报foo转换中Boolean,所以
Boolean(foo);
//true
Run Code Online (Sandbox Code Playgroud)
如果"foo"为"true",为什么第二个警报不起作用?