上传文件

dev_0531
root 6 years ago
parent 3893c65267
commit f501991449

@ -4,7 +4,6 @@ import com.kiisoo.ic.common.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@ -32,7 +31,7 @@ public class FileController extends BaseController {
if (!targetPath.exists()) {
boolean state = targetPath.mkdirs();
}
FileOutputStream out = new FileOutputStream("upload" + fileName);
FileOutputStream out = new FileOutputStream("upload/" + fileName);
out.write(file.getBytes());
out.flush();
out.close();
@ -40,7 +39,7 @@ public class FileController extends BaseController {
log.error("上传出错", e);
return fail();
}
return data("/upload" + fileName);
return data("/upload/" + fileName);
}
private String renameToUUID(String filename) {

Loading…
Cancel
Save