を使用してファイルデータをエンコードしていますjson_encode
。これは、エンコードされたデータを Javascript で送信したときに得られるものです。
これは私のphpコードです(codeigniterを使用してファイルをアップロードします):
$file_info = $this->upload->data();
echo json_encode($file_info);
そして、JavaScriptファイルでデータを使用します:
'onUploadSuccess' : function(file, data, response) {
alert('The file was saved to: ' + data);
}
エンコードされているファイル名またはその他の文字列を使用するにはどうすればよいですか?!
たとえば、次のように使用できます。
'onUploadSuccess' : function(file, data, response) {
alert('The file name is: ' + file_name);
}