Commit 5b791d36 authored by yangshuxing's avatar yangshuxing

增加格式

parent cc1f9913
......@@ -144,7 +144,11 @@ public class OSSClientUtil {
objectMetadata.setHeader("Pragma", "no-cache");
String type = getcontentType(fileName.substring(fileName.lastIndexOf(".") + 1, fileName.length()));
objectMetadata.setContentType(type);
objectMetadata.setContentDisposition("inline;filename=" + fileName);
if(fileName.indexOf("kml") > -1 || fileName.indexOf("gps") > -1){
objectMetadata.setContentDisposition("inline;filename=" + fileName);
}else{
objectMetadata.setContentDisposition("attachment;filename=" + fileName);
}
PutObjectResult putResult = client.putObject(BUCKET_NAME, filedir + fileName, instream, objectMetadata);
ret = putResult.getETag();
String fileOSSUrl = "";
......@@ -227,41 +231,33 @@ public class OSSClientUtil {
System.out.println(extention);
if (extention.equalsIgnoreCase("bmp")) {
return "image/bmp";
}
if (extention.equalsIgnoreCase("gif")) {
}else if (extention.equalsIgnoreCase("gif")) {
return "image/gif";
}
if (extention.equalsIgnoreCase("jpeg") ||
}else if (extention.equalsIgnoreCase("jpeg") ||
extention.equalsIgnoreCase("jpg") ||
extention.equalsIgnoreCase("png")) {
return "image/jpeg";
}
if (extention.equalsIgnoreCase("html")) {
}else if (extention.equalsIgnoreCase("html")) {
return "text/html";
}
if (extention.equalsIgnoreCase("txt")) {
}else if (extention.equalsIgnoreCase("txt")) {
return "text/plain";
}
if (extention.equalsIgnoreCase("vsd")) {
}else if (extention.equalsIgnoreCase("vsd")) {
return "application/vnd.visio";
}
if (extention.equalsIgnoreCase("pptx") ||
}else if (extention.equalsIgnoreCase("pptx") ||
extention.equalsIgnoreCase("ppt")) {
return "application/vnd.ms-powerpoint";
}
if (extention.equalsIgnoreCase("docx") ||
}else if (extention.equalsIgnoreCase("docx") ||
extention.equalsIgnoreCase("doc")) {
return "application/msword";
}
if (extention.equalsIgnoreCase("xml")) {
}else if (extention.equalsIgnoreCase("xml")) {
return "text/xml";
}
if (extention.equalsIgnoreCase("xls") ||
}else if (extention.equalsIgnoreCase("xls") ||
extention.equalsIgnoreCase("xlsx")) {
return "application/vnd.ms-excel";
}
if (extention.equalsIgnoreCase("pdf")) {
}else if (extention.equalsIgnoreCase("pdf")) {
return "application/pdf";
}else if(extention.equalsIgnoreCase("kml") || extention.equalsIgnoreCase("gpx")){
return "application/octet-stream";
}
return "image/jpeg";
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment