Java Code Examples for org.jeecg.modules.oss.entity.OSSFile#setUrl()

The following examples show how to use org.jeecg.modules.oss.entity.OSSFile#setUrl() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SysUploadController.java    From jeecg-cloud with Apache License 2.0 6 votes vote down vote up
/**
 * 上传
 * @param request
 */
@PostMapping(value = "/uploadMinio")
public Result<?> uploadMinio(HttpServletRequest request) {
    Result<?> result = new Result<>();
    String bizPath = request.getParameter("biz");
    if(oConvertUtils.isEmpty(bizPath)){
        bizPath = "";
    }
    MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
    MultipartFile file = multipartRequest.getFile("file");// 获取上传文件对象
    String orgName = file.getOriginalFilename();// 获取文件名
    orgName = CommonUtils.getFileName(orgName);
    String file_url =  MinioUtil.upload(file,bizPath);
    //保存文件信息
    OSSFile minioFile = new OSSFile();
    minioFile.setFileName(orgName);
    minioFile.setUrl(file_url);
    ossFileService.save(minioFile);
    result.setMessage(file_url);
    result.setSuccess(true);
    return result;
}
 
Example 2
Source File: SysUploadController.java    From teaching with Apache License 2.0 6 votes vote down vote up
/**
 * 上传
 * @param request
 */
@PostMapping(value = "/uploadMinio")
public Result<?> uploadMinio(HttpServletRequest request) {
    Result<?> result = new Result<>();
    String bizPath = request.getParameter("biz");
    if(oConvertUtils.isEmpty(bizPath)){
        bizPath = "";
    }
    MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
    MultipartFile file = multipartRequest.getFile("file");// 获取上传文件对象
    String orgName = file.getOriginalFilename();// 获取文件名
    String file_url =  MinioUtil.upload(file,bizPath);
    //保存文件信息
    OSSFile minioFile = new OSSFile();
    minioFile.setFileName(orgName);
    minioFile.setUrl(file_url);
    ossFileService.save(minioFile);
    result.setMessage(file_url);
    result.setSuccess(true);
    return result;
}
 
Example 3
Source File: SysUploadController.java    From jeecg-boot with Apache License 2.0 6 votes vote down vote up
/**
 * 上传
 * @param request
 */
@PostMapping(value = "/uploadMinio")
public Result<?> uploadMinio(HttpServletRequest request) {
    Result<?> result = new Result<>();
    String bizPath = request.getParameter("biz");
    if(oConvertUtils.isEmpty(bizPath)){
        bizPath = "";
    }
    MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
    MultipartFile file = multipartRequest.getFile("file");// 获取上传文件对象
    String orgName = file.getOriginalFilename();// 获取文件名
    orgName = CommonUtils.getFileName(orgName);
    String file_url =  MinioUtil.upload(file,bizPath);
    //保存文件信息
    OSSFile minioFile = new OSSFile();
    minioFile.setFileName(orgName);
    minioFile.setUrl(file_url);
    ossFileService.save(minioFile);
    result.setMessage(file_url);
    result.setSuccess(true);
    return result;
}
 
Example 4
Source File: OSSFileServiceImpl.java    From jeecg-cloud with Apache License 2.0 5 votes vote down vote up
@Override
public void upload(MultipartFile multipartFile) throws IOException {
	String fileName = multipartFile.getOriginalFilename();
	fileName = CommonUtils.getFileName(fileName);
	OSSFile ossFile = new OSSFile();
	ossFile.setFileName(fileName);
	String url = OssBootUtil.upload(multipartFile,"upload/test");
	ossFile.setUrl(url);
	this.save(ossFile);
}
 
Example 5
Source File: OSSFileServiceImpl.java    From jeecg-boot-with-activiti with MIT License 5 votes vote down vote up
@Override
public void upload(MultipartFile multipartFile) throws IOException {
	String fileName = multipartFile.getOriginalFilename();
	OSSFile ossFile = new OSSFile();
	ossFile.setFileName(fileName);
	ossFile.setUrl("https://" + properties.getBucketName() + "." + properties.getEndpoint() + "/" + fileName);
	this.save(ossFile);
	ossManager.upload(fileName, multipartFile.getInputStream());
}
 
Example 6
Source File: OSSFileServiceImpl.java    From teaching with Apache License 2.0 5 votes vote down vote up
@Override
public void upload(MultipartFile multipartFile) throws IOException {
	String fileName = multipartFile.getOriginalFilename();
	OSSFile ossFile = new OSSFile();
	ossFile.setFileName(fileName);
	String url = OssBootUtil.upload(multipartFile,"upload/test");
	ossFile.setUrl(url);
	this.save(ossFile);
}
 
Example 7
Source File: OSSFileServiceImpl.java    From jeecg-boot with Apache License 2.0 5 votes vote down vote up
@Override
public void upload(MultipartFile multipartFile) throws IOException {
	String fileName = multipartFile.getOriginalFilename();
	fileName = CommonUtils.getFileName(fileName);
	OSSFile ossFile = new OSSFile();
	ossFile.setFileName(fileName);
	String url = OssBootUtil.upload(multipartFile,"upload/test");
	ossFile.setUrl(url);
	this.save(ossFile);
}