Closed tranice closed 3 years ago
it is the issue of content-type.
@tranice @slightfoot @neohboonyee99 @brianegan @ened @raphaelgurtner what does setting no content-type header means? Can you please tell me what to write? Here is my code:
await FlutterUploader().enqueue(
RawUpload(
url: uploadUrls[i],
// required: url to upload to
path: selectedVideos[i].path,
// required: list of files that you want to upload
method: UploadMethod.PUT,
// HTTP method (POST or PUT or PATCH)
// headers: {"apikey": "api_123456", "userkey": "userkey_123456"},
//I have also tried uncommenting this headers property and also tried adding "content-type": ""
tag: 'post video uploading', // custom tag which is returned in result/progress
),
);
I have also tried uncommenting this headers property and also tried adding "content-type": "". but I still keep getting this:
2022-10-14 22:38:30.737288-0700 Runner[38503:2433526] URLSessionDidSendBodyData: chillisource.flutter_uploader.upload.background.D598E59F-A80E-4679-A0FD-C96072EBD3C0, byteSent: 27486, totalBytesSent: 1436312, totalBytesExpectedToSend: 1436312, progress:100.0
2022-10-14 22:38:35.192360-0700 Runner[38503:2433526] URLSessionDidReceiveData:
2022-10-14 22:38:35.195193-0700 Runner[38503:2433244] URLSessionDidCompleteWithError: chillisource.flutter_uploader.upload.background.D598E59F-A80E-4679-A0FD-C96072EBD3C0 with response: <NSHTTPURLResponse: 0x600000f43d20> { URL: https://storage.googleapis.com/upload/storage/v1/b/vip-picnic-app.appspot.com/o?name=storyVideos0.000000hBzdHCIpRoNZQtOtfPwxgeLcdjN20.00000097068b00-4c4b-11ed-bba8-7beae6c674d0.mp4&uploadType=resumable&upload_id=ADPycdt3HJwFYv0lbVuC0fD3BF9Mm8oPTY6SHjAwQJYJMxxfoofxpqMXAHMbFsWHFvBJtT-JPT7cWZcvp3SSZMpk08Ntgg } { Status Code: 200, Headers {
"Alt-Svc" = (
"h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000,h3-Q050=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000,quic=\":443\"; ma=2592000; v=\"46,43\""
);
"Cache-Control" = (
"no-cache, no-store, max-age=0, must-revalidate"
);
"Content-Length" = (
1051
);
"Content-Type" = (
"application/json; charset=UTF-8"
);
Date = (
"Sat, 15 Oct 2022 05:38:35 GMT"
);
Etag =
2022-10-14 22:38:35.195748-0700 Runner[38503:2433244] URLSessionDidCompleteWithError: upload completed
2022-10-14 22:38:35.197371-0700 Runner[38503:2433244] URLSessionDidCompleteWithError: response: {
"kind": "storage#object",
"id": "vip-picnic-app.appspot.com/storyVideos/hBzdHCIpRoNZQtOtfPwxgeLcdjN2/97068b00-4c4b-11ed-bba8-7beae6c674d0.mp4/1665812314898425",
"selfLink": "https://www.googleapis.com/storage/v1/b/vip-picnic-app.appspot.com/o/storyVideos0.000000hBzdHCIpRoNZQtOtfPwxgeLcdjN20.00000097068b00-4c4b-11ed-bba8-7beae6c674d0.mp4",
"mediaLink": "https://storage.googleapis.com/download/storage/v1/b/vip-picnic-app.appspot.com/o/storyVideos0.000000hBzdHCIpRoNZQtOtfPwxgeLcdjN20.00000097068b00-4c4b-11ed-bba8-7beae6c674d0.mp4?generation=1665812314898425&alt=media",
"name": "storyVideos/hBzdHCIpRoNZQtOtfPwxgeLcdjN2/97068b00-4c4b-11ed-bba8-7beae6c674d0.mp4",
"bucket": "vip-picnic-app.appspot.com",
"generation": "1665812314898425",
"metageneration": "1",
"storageClass": "STANDARD",
"size": "1436312",
"md5Hash": "PbTA0xQyreLSsiI3AkB4qA==",
"crc32c": "FJx0tg==",
"etag": "CPn/qrrC4foCEAE=",
"timeCreated": "2022-10-15T05:38:35.003Z",
"update
What content type is the file you are uploading? You need to match it using Content-Type
.
Hi , thanks for great work! I use flutter_uploader 1.2.1 to upload file and photos to server, server code is asp.net core web api ,like following code: public Response UploadFile(IFormFile file) { / code .../ } everything is ok where in Android. but in IOS device:iphone 7 plus. it is not work. from log, file had been uploaded ,but in server file is null(as code above). log: URLSessionDidCompleteWithError: upload completed URLSessionDidCompleteWithError: response: {"returnValue":null,"isSuccess":false,"code":"0","description":"no file!"}, task: completed URLSessionDidSendBodyData: taskId: chillisource.flutter_uploader.upload.background.13, byteSent: 390718, totalBytesSent: 390718, totalBytesExpectedToSend: 390718, progress:100.0 URLSessionDidReceiveData: URLSessionDidCompleteWithError: chillisource.flutter_uploader.upload.background.13 with response: <NSHTTPURLResponse: 0x28285abc0> ...
would you please give some help?