Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
cloud-aliyun
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hqzhdj
cloud-aliyun
Commits
175b0640
Commit
175b0640
authored
Feb 18, 2025
by
阳浪
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
文件上传
parent
f7e15fdf
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
cloud-aliyun-service/src/main/java/com/yizhi/aliyun/application/controller/FileUploadController.java
+5
-5
No files found.
cloud-aliyun-service/src/main/java/com/yizhi/aliyun/application/controller/FileUploadController.java
View file @
175b0640
...
@@ -28,15 +28,14 @@ public class FileUploadController {
...
@@ -28,15 +28,14 @@ public class FileUploadController {
String
pcHostUrl
;
String
pcHostUrl
;
@PostMapping
(
"/upload"
)
@PostMapping
(
"/upload"
)
public
Response
<
String
>
uploadFile
(
@RequestParam
(
"file"
)
MultipartFile
file
,
@RequestParam
(
"Filename"
)
String
Filename
)
{
public
Response
<
String
>
uploadFile
(
@RequestParam
(
"file"
)
MultipartFile
file
)
{
try
{
try
{
String
[]
fileNames
=
Filename
.
split
(
"/"
);;
String
bucketName
=
propertiesUtil
.
getPublicParam
().
get
(
"ossdir"
);;
String
bucketName
=
fileNames
[
0
];
String
name
=
file
.
getOriginalFilename
();
String
name
=
fileNames
[
1
];
minioTools
.
uplodFile
(
bucketName
,
name
,
file
.
getInputStream
());
minioTools
.
uplodFile
(
bucketName
,
name
,
file
.
getInputStream
());
return
Response
.
ok
(
pcHostUrl
+
"/api/v1/buckets/"
+
bucketName
+
"/objects/download/?preview=true&prefix="
+
name
);
return
Response
.
ok
(
pcHostUrl
+
"/api/v1/buckets/"
+
bucketName
+
"/objects/download/?preview=true&prefix="
+
name
);
}
catch
(
IOException
ex
)
{
}
catch
(
IOException
ex
)
{
return
Response
.
fail
(
"Could not upload the file
: "
+
Filename
);
return
Response
.
fail
(
"Could not upload the file
"
);
}
}
}
}
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment