上传未知大小的文件 OneDrive
Upload File with unknown size OneDrive
所以我正在使用可恢复的文件上传会话将文件上传到一个驱动器。但是在上传之前我不知道文件的大小。我知道 google 允许上传内容范围如
的文件
Content-Range: 0-128/*
我假设 OneDrive 也会允许它,因为它甚至在 RFC2616 中指定
Content-Range = "Content-Range" ":" content-range-spec
content-range-spec = byte-content-range-spec
byte-content-range-spec = bytes-unit SP
byte-range-resp-spec "/"
( instance-length | "*" )
byte-range-resp-spec = (first-byte-pos "-" last-byte-pos)
| "*"
instance-length = 1*DIGIT
The header SHOULD indicate the total length of the full
entity-body, unless this length is unknown or difficult to
determine. The asterisk "*" character means that the
instance-length is unknown at the time when the response was
generated.
但在阅读 OneDrive 文档后我发现它说
Example: In this example, the app is uploading the first 26 bytes of a
128 byte file.
The Content-Length header specifies the size of the current request.
The Content-Range header indicates the range of bytes in the overall
file that this request represents.
The total length of the file is
known before you can upload the first fragment of the file. HTTP
Copy PUT https://sn3302.up.1drv.com/up/fe6987415ace7X4e1eF866337
Content-Length: 26 Content-Range: bytes 0-25/128
<bytes 0-25 of the file>
Important: Your app must ensure the total
file size specified in the Content-Range header is the same for all
requests. If a byte range declares a different file size, the request
will fail.
也许我只是读错了文档,或者它只适用于这个例子,但在我开始构建整个上传器之前,我想澄清一下 OneDrive 是否允许这样做
我的问题是
OneDrive 是否允许上传大小未知的文件?
在此先感谢您的帮助
对于其他想知道的人,不可以,文件上传必须指定大小。
所以我正在使用可恢复的文件上传会话将文件上传到一个驱动器。但是在上传之前我不知道文件的大小。我知道 google 允许上传内容范围如
的文件Content-Range: 0-128/*
我假设 OneDrive 也会允许它,因为它甚至在 RFC2616 中指定
Content-Range = "Content-Range" ":" content-range-spec
content-range-spec = byte-content-range-spec byte-content-range-spec = bytes-unit SP byte-range-resp-spec "/" ( instance-length | "*" ) byte-range-resp-spec = (first-byte-pos "-" last-byte-pos) | "*" instance-length = 1*DIGIT
The header SHOULD indicate the total length of the full entity-body, unless this length is unknown or difficult to determine. The asterisk "*" character means that the instance-length is unknown at the time when the response was generated.
但在阅读 OneDrive 文档后我发现它说
Example: In this example, the app is uploading the first 26 bytes of a 128 byte file.
The Content-Length header specifies the size of the current request.
The Content-Range header indicates the range of bytes in the overall file that this request represents.
The total length of the file is known before you can upload the first fragment of the file. HTTP
Copy PUT https://sn3302.up.1drv.com/up/fe6987415ace7X4e1eF866337 Content-Length: 26 Content-Range: bytes 0-25/128 <bytes 0-25 of the file>
Important: Your app must ensure the total file size specified in the Content-Range header is the same for all requests. If a byte range declares a different file size, the request will fail.
也许我只是读错了文档,或者它只适用于这个例子,但在我开始构建整个上传器之前,我想澄清一下 OneDrive 是否允许这样做
我的问题是
OneDrive 是否允许上传大小未知的文件?
在此先感谢您的帮助
对于其他想知道的人,不可以,文件上传必须指定大小。