ssh框架ajaxFileUpload上传文件后文件变成tmp文件
ajaxFileUpload上传文件后文件变成tmp文件,但是直接将文件后缀改成xlsx后,打开会提示有无法读取的内容。js代码:fileUpload:function(...
ajaxFileUpload上传文件后文件变成tmp文件,但是直接将文件后缀改成xlsx后,打开会提示有无法读取的内容。
js代码:
fileUpload : function(rowIndx) {
$.ajaxFileUpload({
url : BM0010URL.fileUpload,
secureuri : true,
fileElementId :'fileButton',
async : false,
dataType : 'json',
data : {
'bm0010vo.bm0010001vo.propertyNo' : $('#propertyNoTx').val(),
'bm0010vo.bm0010009vo.fileNo' : $('#fileNoHdn').val()
},
error: function(response) {
common.catchAjaxFailure(response);
},
success: function(data) {
// グリッドのデータを変更
BM0010009.variable.obj.dataModel.data[rowIndx].filePath = data.bm0010vo.bm0010009vo.filePath;
// サーバに戻すデータを修正
BM0010009.variable.updateSubmitData(BM0010009.variable.obj.dataModel.data[rowIndx]);
}
});
$('#fileButton').on('change', function(){
BM0010009.button.selectFile(null, BM0010009.variable.selectRow, BM0010009.variable.rowIndx);
});
return false;
},
jsp代码:
<s:hidden id="fileNoHdn" name="bm0010vo.bm0010009vo.fileNo"></s:hidden>
struts.xml代码:
<action name="fileUpload" class="jp.co.eneres.bulkpower.bm.presentation.action.BM0010Action" method="fileUpload">
<result name="success" type="json">
<param name="contentType">
text/html
</param>
</result>
</action>
后台主要代码:
InputStream in = null;
OutputStream out = null;
try {
in = new BufferedInputStream(new FileInputStream(uploadFile), BUFFER_SIZE);
out = new BufferedOutputStream(new FileOutputStream(saveFile), BUFFER_SIZE);
byte[] buffer = new byte[BUFFER_SIZE];
while (in.read(buffer) > 0) {
out.write(buffer);
}
}
请大神帮忙看下 展开
js代码:
fileUpload : function(rowIndx) {
$.ajaxFileUpload({
url : BM0010URL.fileUpload,
secureuri : true,
fileElementId :'fileButton',
async : false,
dataType : 'json',
data : {
'bm0010vo.bm0010001vo.propertyNo' : $('#propertyNoTx').val(),
'bm0010vo.bm0010009vo.fileNo' : $('#fileNoHdn').val()
},
error: function(response) {
common.catchAjaxFailure(response);
},
success: function(data) {
// グリッドのデータを変更
BM0010009.variable.obj.dataModel.data[rowIndx].filePath = data.bm0010vo.bm0010009vo.filePath;
// サーバに戻すデータを修正
BM0010009.variable.updateSubmitData(BM0010009.variable.obj.dataModel.data[rowIndx]);
}
});
$('#fileButton').on('change', function(){
BM0010009.button.selectFile(null, BM0010009.variable.selectRow, BM0010009.variable.rowIndx);
});
return false;
},
jsp代码:
<s:hidden id="fileNoHdn" name="bm0010vo.bm0010009vo.fileNo"></s:hidden>
struts.xml代码:
<action name="fileUpload" class="jp.co.eneres.bulkpower.bm.presentation.action.BM0010Action" method="fileUpload">
<result name="success" type="json">
<param name="contentType">
text/html
</param>
</result>
</action>
后台主要代码:
InputStream in = null;
OutputStream out = null;
try {
in = new BufferedInputStream(new FileInputStream(uploadFile), BUFFER_SIZE);
out = new BufferedOutputStream(new FileOutputStream(saveFile), BUFFER_SIZE);
byte[] buffer = new byte[BUFFER_SIZE];
while (in.read(buffer) > 0) {
out.write(buffer);
}
}
请大神帮忙看下 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询