Java Code Examples for com.ruoyi.common.config.Global#getUploadPath()

The following examples show how to use com.ruoyi.common.config.Global#getUploadPath() . 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: CommonController.java    From supplierShop with MIT License 6 votes vote down vote up
/**
 * 通用上传请求
 */
@PostMapping("/common/upload")
@ResponseBody
public AjaxResult uploadFile(MultipartFile file) throws Exception
{
    try
    {
        // 上传文件路径
        String filePath = Global.getUploadPath();
        // 上传并返回新文件名称
        String fileName = FileUploadUtils.upload(filePath, file);
        String url = serverConfig.getUrl() + fileName;
        AjaxResult ajax = AjaxResult.success();
        ajax.put("fileName", fileName);
        ajax.put("url", url);
        return ajax;
    }
    catch (Exception e)
    {
        return AjaxResult.error(e.getMessage());
    }
}
 
Example 2
Source File: CommonController.java    From ruoyiplus with MIT License 6 votes vote down vote up
/**
 * 通用上传请求
 */
@PostMapping("/common/upload")
@ResponseBody
public AjaxResult uploadFile(MultipartFile file) throws Exception
{
    try
    {
        // 上传文件路径
        String filePath = Global.getUploadPath();
        // 上传并返回新文件名称
        String fileName = FileUploadUtils.upload(filePath, file);
        String url = serverConfig.getUrl() + UPLOAD_PATH + fileName;
        AjaxResult ajax = AjaxResult.success();
        ajax.put("fileName", fileName);
        ajax.put("url", url);
        return ajax;
    }
    catch (Exception e)
    {
        return AjaxResult.error(e.getMessage());
    }
}
 
Example 3
Source File: CommonController.java    From RuoYi with Apache License 2.0 6 votes vote down vote up
@PostMapping("/common/upload")
@ResponseBody
@ApiOperation(value = "通用文件上传")
@ApiImplicitParams({
        @ApiImplicitParam(name = "fileName",value = "文件名",required = true),
        @ApiImplicitParam(name = "delete",value = "是否删除临时文件",required = true,dataType ="boolean")
})
public AjaxResult uploadFile(MultipartFile file){
    try
    {
        // 上传文件路径
        String filePath = Global.getUploadPath();
        // 上传并返回新文件名称
        String fileName = FileUploadUtils.upload(filePath, file);
        String url = serverConfig.getUrl() + UPLOAD_PATH + fileName;
        AjaxResult ajax = AjaxResult.success();
        ajax.put("fileName", fileName);
        ajax.put("url", url);
        return ajax;
    }
    catch (Exception e)
    {
        return AjaxResult.error(e.getMessage());
    }
}