| | |
| | | import org.apache.http.impl.client.CloseableHttpClient; |
| | | import org.apache.http.impl.client.HttpClients; |
| | | import org.apache.http.util.EntityUtils; |
| | | import org.springblade.common.constant.FtpConstant; |
| | | import org.springblade.common.utils.arg; |
| | | import org.springblade.core.launch.constant.AppConstant; |
| | | import org.springblade.core.oss.model.BladeFile; |
| | |
| | | String newName = "upload/picture/" + UUID.randomUUID().toString().replaceAll("-", "") |
| | | + fileName.substring(fileName.lastIndexOf(".")); |
| | | InputStream in = file.getInputStream(); |
| | | String[] split = newName.split("/"); |
| | | //创建头部信息 |
| | | Map<String, String> headers = new HashMap<>(1 << 2); |
| | | //添加自定义内容类型 |
| | |
| | | in, in.available(), -1) |
| | | .headers(headers) |
| | | .build()); |
| | | InputStream inputStream = file.getInputStream(); |
| | | FtpUtil.uploadFile(ftpHost_dev, ftpPort, ftpUserName, ftpPassword, ftpPath, "/", split[2], inputStream); |
| | | in.close(); |
| | | String urls = "http://223.82.109.183:2081/zhba/" + newName; |
| | | return R.data(urls); |
| | |
| | | in, in.available(), -1) |
| | | .headers(headers) |
| | | .build()); |
| | | FtpUtil.uploadFile(ftpHost_dev, ftpPort, ftpUserName, ftpPassword, ftpPath, "/", split[2], in); |
| | | InputStream inputStream = file.getInputStream(); |
| | | FtpUtil.uploadFile(ftpHost_dev, ftpPort, ftpUserName, ftpPassword, ftpPath, "/", split[2], inputStream); |
| | | in.close(); |
| | | String urls = "http://223.82.109.183:2081/zhba/" + newName; |
| | | //数据封装 |
| | |
| | | in, in.available(), -1) |
| | | .headers(headers) |
| | | .build()); |
| | | FtpUtil.uploadFile(ftpHost_dev, ftpPort, ftpUserName, ftpPassword, ftpPath, "/", split[2], in); |
| | | InputStream inputStream = file.getInputStream(); |
| | | FtpUtil.uploadFile(ftpHost_dev, ftpPort, ftpUserName, ftpPassword, ftpPath, "/", split[2], inputStream); |
| | | in.close(); |
| | | String urls = "http://223.82.109.183:2081/zhba/" + newName; |
| | | //数据封装 |
| | |
| | | } |
| | | attachService.save(attach); |
| | | String[] split = bladeFile.getName().split("/"); |
| | | String ip = "http://192.168.0.108/zhba/picture/"; |
| | | String ip = FtpConstant.ip+"/zhba/picture/"; |
| | | String imgurl = ip + split[2]; |
| | | FtpUtil.uploadFile(ftpHost_dev, ftpPort, ftpUserName, ftpPassword, ftpPath, "/", split[2], in); |
| | | //数据同步 |