我已经从javascript读取了一个文件并将其转换为64位编码数据 这个数据已经传递给了php.How我会解码吗?
以下是我的代码
//function to encode into 64 bit
function handleFileSelect(objEvent) {
var strFiles = objEvent.target.files; // FileList object
//Checking wheter the uploaded file is image or not
for (var i = 0, f; f = strFiles[i]; i++) {
var reader = new FileReader();
// Closure to capture the file information.
reader.onload = (function(theFile) {
return function(e) {
// Render thumbnail.
strGlobalImageData=e.target.result;alert(strGlobalImageData);
};
})(f);
reader.readAsDataURL(f);
}
}
//我需要通过ajax
将这些数据传递给phpvar app ='contact.php';
$.ajax({
url: app,
async: false,
type:"POST",
data : "file="+strGlobalImageData,
dataType: "jsonp",
contentType: 'application/x-www-form-urlencoded',
processData:false,
jsonp: "jsoncallback",
success: function(html){
alert("Thank you. We will be in touch with you");
},
error: function(){
alert("Error");
}
});
</script>
我在php中获取此编码数据。但我无法解码并查看其属性
喜欢'tmp_name','name'......
提前致谢....