/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.ifish.controller;

import com.ifish.helper.FastDFSClientI;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;

/**
 *
 * @author Administrator
 */
@Controller
public class Index {

    @RequestMapping(value = "/", method = RequestMethod.GET)   //处理路由的请求
    public String index() {
        return "index"; //返回的视图名为index（指向/WEB-INF/Views/index.jsp）
    }

    @Autowired
    private FastDFSClientI fastDFSClientI;

    @RequestMapping(value = "/test", method = RequestMethod.POST)
    @ResponseBody
    public String test(MultipartFile file) {
        String filstring = fastDFSClientI.uploadFileToFastDFS(file);
        return filstring;

    }
}
