feat: fix issues
This commit is contained in:
@@ -20,7 +20,7 @@ type uploads struct {
|
||||
}
|
||||
|
||||
func (up *uploads) storagePath() string {
|
||||
return filepath.Join(up.app.StoragePath, "uploads/tmp")
|
||||
return filepath.Join(up.app.StoragePath, "uploads")
|
||||
}
|
||||
|
||||
type UploadChunk struct {
|
||||
@@ -32,7 +32,6 @@ type UploadFileInfo struct {
|
||||
Md5 string `json:"md5"`
|
||||
Filename string `json:"filename"`
|
||||
Mime string `json:"mime"`
|
||||
Size int64 `json:"size"`
|
||||
Chunks int `json:"chunks"`
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
[App]
|
||||
Mode = "development"
|
||||
BaseURI = "baseURI"
|
||||
StoragePath = "/Users/rogee/Projects/self/quyun/fixtures"
|
||||
|
||||
[Http]
|
||||
Port = 8088
|
||||
|
||||
15
test.http
15
test.http
@@ -1,7 +1,7 @@
|
||||
@host=http://localhost:8088
|
||||
|
||||
@md5=959e5310105c96e653f10b74e5bdc36b
|
||||
@idx=0
|
||||
@idx=9
|
||||
### upload chunk
|
||||
POST {{host}}/v1/uploads/{{md5}}/chunks/{{idx}} HTTP/1.1
|
||||
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW
|
||||
@@ -10,10 +10,21 @@ Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0g
|
||||
Content-Disposition: form-data; name="file"; filename="0"
|
||||
Content-Type: application/octet-stream
|
||||
|
||||
< ./fixtures/files/0
|
||||
< ./fixtures/files/{{idx}}
|
||||
------WebKitFormBoundary7MA4YWxkTrZu0gW--
|
||||
|
||||
|
||||
### complete upload
|
||||
POST {{host}}/v1/uploads/{{md5}}/complete HTTP/1.1
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"md5": "{{md5}}",
|
||||
"filename": "camera.mp4",
|
||||
"mime": "video/mp4",
|
||||
"chunks": 30
|
||||
}
|
||||
|
||||
### get medias
|
||||
GET {{host}}/v1/medias HTTP/1.1
|
||||
Content-Type: application/json
|
||||
Reference in New Issue
Block a user