package com.example.controller;

import com.example.util.AliyunOSSConfigConstant;
import com.example.util.AliyunOSSUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.io.File;
import java.io.FileOutputStream;

/**
 * 〈一句话功能简述〉<br>
 * 〈测试oss是否可用〉
 *
 * @author xunyong
 * @create 2019/2/21
 * @since 1.0.0
 */
@Controller
@RestController
@RequestMapping("/oss")
public class AliyunOSSController {

	
	 @Autowired
	    private AliyunOSSUtil aliyunOSSUtil;
    /**
     * 文件上传（供前端调用）
     */
    @RequestMapping(value = "/test", method = RequestMethod.GET)
    public String uploadPicture2() {
        File file = new File("E:\\images\\6.png");
        // 上传到OSS
        String uploadUrl = aliyunOSSUtil.upLoad(file);
        return uploadUrl;
    }
}
