http://1.1.1.1:9999/bucketName/123/a.pdf?response-content-disposition=attachment&Expires=1592402977&OSSAccessKeyId=a&Signature=b 然后就可以愉快的根据设置不同的disposition入参("attachment"及"inline")来选择性生成预览或者下载的链接了。
// 以下可选字段的含义参考: https://docs.aliyun.com/#/pub/oss/api-reference/object&PutObject // put.contentType = @""; // put.contentMd5 = @""; // put.contentEncoding = @""; // put.contentDisposition = @""; // put.objectMeta = [NSMutableDictionary dictionaryWithObjectsAndKeys:@...
objectMetadata.setContentLength(ContentLength); objectMetadata.setCacheControl("no-cache"); objectMetadata.setHeader("Pragma", "no-cache"); objectMetadata.setContentType(getContentType(fileName.substring(fileName.lastIndexOf("."))); objectMetadata.setContentDisposition("inline;filename=" + fileName...
response.setContentType("application/octet-stream");//文件名可以任意指定response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(fileName,"UTF-8"));//将文件名转为ASCLL编码intread;while((read = inputStream.read(data)) != -1) { response.getOutputStream().write(d...
objectMetadata.setContentDisposition("inline;filename=" + fileName); // 上传文件 ossClient.putObject(ossConfigure.getBucketName(), remoteFilePath + fileName, fileContent, objectMetadata); // 关闭OSSClient ossClient.shutdown(); // 关闭io流 ...