jQWidgets Forums
jQuery UI Widgets › Forums › General Discussions › Do I use jqxFileUpload in IE 9 or 11 ?
Tagged: javascript jqxFileUpload, jquery jqxFileUpload, jqwidgets jqxFileUpload, jqxFileUpload Internet Explorer
This topic contains 1 reply, has 2 voices, and was last updated by Todor 5 years, 10 months ago.
-
Author
-
Hello
First, Please understand my poor English.
I use jqxFileUpload.
It’s good to use in Chrome
But when I use Internet Explorer, IE ask to user download ~~.json file..
and I think this reason
———————————————————–
request header
Accept: text/html, application/xhtml+xml, image/jxr, */*Response header
Contetn-Type: application/json; charset=UTF-8
———————————————————–Is it possible to use Internet Explorer ?
Please help me…..
[Client Side] —————————————————————————————————–
/**
* ui handling
*/
$(document).ready(function () {var data = [];
var filecnt = 0;
formInit();// event handler
$(‘#jqxFileUpload’).on(‘uploadEnd’, function (event) {
var args = event.args;
var fileName = args.file;
var serverResponse = args.response;
// Your code here.var parsedObject = JSON.parse($(serverResponse).text());
if(parsedObject.length > 0){
data.push(parsedObject[0]);
console.log(parsedObject);
}if(filecnt == 1){
commonDialog.returnData = JSON.stringify(data);
commonDialog.callback();
commonDialog.close();
}
});$(‘#jqxFileUpload’).on(‘remove’, function (event) {
filecnt –;
console.log(“remove filecnt”,filecnt);
var newHeight = $(‘#jqxFileUpload’).outerHeight();if(filecnt == 0){
setTimeout(function() {
commonDialog.resize(179+”px”);
}, 250);
}
else if(filecnt == 1){
setTimeout(function() {
commonDialog.resize(258+”px”);
}, 250);
}
else {
newHeight = newHeight + 143;
console.log(“remove newHeight”,newHeight);
setTimeout(function() {
commonDialog.resize(newHeight+”px”);
}, 250);
}
});
$(‘#jqxFileUpload’).on(‘select’, function (event) {
filecnt ++;
console.log(“select filecnt”,filecnt);
var newHeight = $(‘#jqxFileUpload’).outerHeight();
if(filecnt == 0){
commonDialog.resize(179+”px”);
}
else if(filecnt == 1){
commonDialog.resize(258+”px”);
}
else {
newHeight = newHeight + 143;
commonDialog.resize(newHeight+”px”);
}
});$(‘#ok’).on(‘click’, function(){
if(filecnt < 1){
alert(“there is no file!”);
return;
}
$(“#jqxFileUpload”).jqxFileUpload(‘uploadAll’);
});
$(‘#cancel’).on(‘click’, function(){
commonDialog.close();
});$(‘#jqxFileUploadCancelButton’).on(‘click’, function(){
commonDialog.close();
});
});var formInit = function () {
$(‘#jqxFileUpload’).jqxFileUpload({
width : “440px”,
height: “auto”,
uploadUrl : uploadUrl,
fileInputName : ‘fileToUpload’,
multipleFilesUpload: multipleFiles,
localization: {
browseButton: ‘add file’,
uploadFileTooltip: ‘upload’,
cancelFileTooltip: ‘cancel’
}
});$(“#ok”).jqxButton({ width: ’65px’,template: “success” });
$(“#cancel”).jqxButton({ width: ’65px’, template: “warning” });$(“.jqx-file-upload-buttons-container”).css(“display”, “none”);
console.log(“init length”,$(“.jqx-widget-content .jqx-rc-all .jqx-file-upload-file-row:visible”).length);
console.log(“init outerHeight”,$(‘#jqxFileUpload’).outerHeight());
}———————————————————————————————————————
[Server Side] ——————————————————————————————————-
@RequestMapping(value = “/fileUpload/{biztype}/{projectcode}”, produces = “application/json;charset=UTF-8”, method = RequestMethod.POST)
public @ResponseBody List<Map<String, Object>> fileUpload(
@PathVariable String biztype, @PathVariable String projectcode,
HttpServletRequest request, HttpServletResponse response) {SimpleDateFormat sdf = new SimpleDateFormat(“yyyyMMdd”);
Calendar calendar = Calendar.getInstance();
String strToday = sdf.format(calendar.getTime());String savePath = filePath + “/” + projectcode + “/” + biztype;
logger.debug(savePath);
List<Map<String, Object>> returnObject = new ArrayList<Map<String,Object>>();
try {
// request MultipartHttpServletRequest
MultipartHttpServletRequest multipartHttpServletRequest = (MultipartHttpServletRequest)request;Iterator<String> iter = multipartHttpServletRequest.getFileNames();
MultipartFile multipartFile = null;
String itemFileName = “”;File directory = new File(savePath);
if (!directory.isDirectory()) {
directory.mkdirs();
}while (iter.hasNext()) {
String fileseq = commonService.selectFileSeq();
itemFileName = (String)iter.next();
multipartFile = multipartHttpServletRequest.getFile(itemFileName);
String originalFileName = new String(multipartFile.getOriginalFilename().getBytes(“8859_1”), “UTF-8”);if (“”.equals(originalFileName)) {
continue;
}
String oridianlFileExt = originalFileName.substring(originalFileName.lastIndexOf(‘.’));String savedFileName = biztype+”_”+ strToday+”_”+fileseq;
File savedFile = new File(savePath + File.separator + savedFileName);
multipartFile.transferTo(savedFile);Map<String, Object> fileHandleResult = new HashMap<String, Object>();
fileHandleResult.put(“nFileSeqNo”, fileseq);
fileHandleResult.put(“vFileName”, originalFileName);
fileHandleResult.put(“vFileExtension”, oridianlFileExt);
fileHandleResult.put(“vTempFileName”, savedFileName);
fileHandleResult.put(“vFilePath”, savePath);
returnObject.add(fileHandleResult);
}} catch (UnsupportedEncodingException e) {
e.printStackTrace();
} catch (IllegalStateException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return returnObject;
}Hello devsim,
Yes, it is possible to use jqxFileUpload with Internet Explorer. I would like to suggest you review the following documentation about Upload files with jqxFileUpload to JSP servlet.
Also you could review the following topic from the forum. I think the issue is similar to yours.
Let us know if you need further assistance.
Best Regards,
TodorjQWidgets Team
https://www.jqwidgets.com -
AuthorPosts
You must be logged in to reply to this topic.