Upload/download

Last updated:2021-10-13 11:07:18

1. What will cause the downloaded file to be inconsistent with the latest uploaded file?

2. How can I upload a large file ?

3. Does KS3 allow uploading a file that uses the same name as an existing file?

4. What will the API do if I call the Put Object Copy interface to copy a file but the target file already exists?

5. Is an automatic jump allowed after a file upload in the POST form?

6. How can I set the Content-Type value when uploading a file?

7. Can I view the file upload progress?

8. How can I terminate an ongoing upload task?

9. Is transmission from a breakpoint supported?

10. Is transfer in seconds supported?

11. What does the ETag in a response header represent during an object upload?

12. A file uploaded by using KS3Up-tool cannot be accessed. Why?

13. What does error code 413 mean for a file upload?

14. Will KS3 impose access control if I use the same pair of AKs/SKs but different IP addresses to access KS3?

15. Can I upload files without AKs/SKs if I use the C/C++ SDK to develop a client?

16. Why does it return error code 408 when I call the API for a speed-limited upload?

17. Why cannot I obtain the ETag response header when I use the JS SDK to upload files?

18. How can I get the access address of a KS3 file?

19. Does KS3 support gzip transmission compression?


1. What will cause the downloaded file to be inconsistent with the latest uploaded file?

Typically, the cause lies in caching. identify whether CDN is used, refresh the CDN, clear the local cache, and request again.

2. How can I upload a large file ?

To upload a file greater than 100 MB, you are recommended to use the API or SDK to perform a multipart upload.
The content management page on the console does not support uploading a file greater than 500 MB or uploading more than 255 files. If the size of a file or the number of files to be uploaded exceeds the limit, you must use the API.

To upload a large file, follow these steps:

  1. Initiate Multipart Upload.
  2. Upload Part.
  3. Complete Multipart Upload.

For more information, see Multipart Upload.

3. Does KS3 allow uploading a file that uses the same name as an existing file?

Yes. KS3 allows you to upload a file that uses the same name as an existing file. However, the original file will be overwritten because version management has not been provided. Before uploading a file, you can use the Head Object interface to check whether the file already exists.

4. What will the API do if I call the Put Object Copy interface to copy a file but the target file already exists?

The API will return the 400 Invalid key message without overwriting the file.

5. Is an automatic jump allowed after a file upload in the POST form?

Yes. You only need to set success_action_redirect in the POST form field and specify the redirect URL of the client after a successful upload. For more information, see POST Object.

6. How can I set the Content-Type value when uploading a file?

Add the Content-Type request header to describe the file content MIME format.
You can use one of the following methods to set the Content-Type value:

7. Can I view the file upload progress?

Yes. While uploading a file on the console, you can view the file upload progress in the upload window. While uploading files by using KS3 Explorer, you can view the file upload progress in the task management window and resume a transmission from a breakpoint. While uploading files by using data migration tool KS3Up-tool, you can view the file upload progress by executing commands on the console.

8. How can I terminate an ongoing upload task?

While uploading a file on the console, you can view the file upload progress in the upload window or click the cross to cancel the upload operation. While uploading files by using GUI tool KS3 Explorer, you can stop and cancel a file upload task in the task management window. For more information, see KS3 Explorer. You can also use the API to terminate a multipart upload task. For more information, see Abort Multipart Upload. If an ongoing upload task cannot be terminated, use the stop or kill command.

9. Is transmission from a breakpoint supported?

GUI tool KS3 Explorer and the multipart upload API support continuing with file transmission from a breakpoint but the console does not. If you start an upload task after forcibly terminating the task, multipart upload is used to continue with the file transmission from the breakpoint if the file is greater than 1 GB. If the file is smaller than 1 GB, you must re-transmit the file.

10. Is transfer in seconds supported?

You can use the Head Object API to identify whether a file to be uploaded already exists on the KS3. If yes, you do not need to upload the file. For a file that is already uploaded, you can use a HEAD request to implement file transfer in seconds.

11. What does the ETag in a response header represent during an object upload?
  • ETag:
    • When you use PUT or POST for a file upload, the system calculates the MD5 value of the message content (excluding the header), which is a 128-bit number. ETag is the hexadecimal code of the 128-bit number. Content-MD5 is the base64 code of the 128-bit number.
    • If you perform a multipart upload, the ETag returned by the Complete interface is only a unique identifier. It has nothing to do with the file content.

For more information, see:

12. A file uploaded by using KS3Up-tool cannot be accessed. Why?

Identify whether the cannedAcl parameter in the conf file is private. If yes, only the file owner or a user with the READ permission can access the file. To access the file, you must pass signature authentication.

13. What does error code 413 mean for a file upload?

Error code 413 means that the file to be uploaded does not meet the following requirements:

  • For a file upload that uses the PUT Object API, the file size must be equal to or smaller than 5 GB.
    -For a file upload that uses multipart upload, each non-final block must be equal to or greater than 100 KB if the file is smaller than 5 MB. If the file is greater than 5 MB, each non-final block must be equal to or greater than 5 MB and equal to or smaller than 5 GB
14. Will KS3 impose access control if I use the same pair of AKs/SKs but different IP addresses to access KS3?

Access Keys (AKs) and Secret Keys (SKs) are used to generate signatures for requests for non-public resources. By default, KS3 does not impose access control if you use the same pair of AKs/SKs and different IP addresses to access KS3.

15. Can I upload files without AKs/SKs if I use the C/C++ SDK to develop a client?

The SDK supports automatic signature calculation, and AKs/SKs need to be written into the program. If you don’t want to specify AKs/SKs, you can construct a signature by yourself according to the KS3 signature format.

16. Why does it return error code 408 when I call the API for a speed-limited upload?

Error code 408 was returned because the server was timed out while waiting for the request. The data interaction idle timeout is 60 seconds. If no data interaction occurs during the period, the server will return error code 408. It is recommended that you check the speed limit settings.

17. Why cannot I obtain the ETag response header when I use the JS SDK to upload files?

You must configure the Exposed Header in the CORS settings, and set the response header that allows access from the application.

Procedure

  1. Log in to the console and select the bucket of the file to be uploaded.
  2. Access the Bucket Settings > CORS Configuration page and set the Allow Origin, Method, and Allow Header, add the Exposed Header, and enter the ETag.
  3. Click Confirm.

Note:
After you configure the bucket CORS policy, it takes 2 minutes for the cache to take effect.

18. How can I get the access address of a KS3 file?

Use one of the following methods:

  • For a public file, construct the URL in the http://{BucketName}.{KS3 Endpoint}/{ObjectName} format, where KS3 Endpoint is the domain name. For example, the URL is http://test-bucket.kss.ksyun.com/2018/image.jpg if the {BucketName} is test-bucket, {KS3 Endpoint} is kss.ksyun.com, and the {ObjectName} is 2018/image.jpg.
KS3 Endpoint (domain name)

KS3 Endpoint refers to the domain name that KS3 uses to provide services to external users. KS3 uses the RESTful API to provide services to external users. It supports HTTP and HTTPS. Different regions require different domain names. The internal network and external network of the same region use different domain names. For more information, see Region and domain comparison table.

KS3 requires that the bucket be in the same region as the Endpoint. For example, if you a bucket named myBucket in BEIJING region and you access https://mybucket.ks3-cn-shanghai.ksyuncs.com/test.jpg (the Endpoint is SHANGHAI), you will get a HTTP response code 307 temporary redirect error message.

In addition, if the ACL of the target file is private, you need to add the signature information. For more information, see Authorization calculation method.

  • Obtain the access address from the management console.
    For more information, see [File sharing](https://docs.ksyun.com/documents/875#File sharing).
19. Does KS3 support gzip transmission compression?

Yes. The request must have the Accept-Encoding request header, and the requested file must be greater than 1 KB.

The following types of files support compression: text, plain application, x-javascript text, css text, javascript application, javascript text, json text, js text, html text, htm text, xml application, xml application, atom+xml application, xml+rss application, xhtml+xml application, and xml-dtd.
When uploading a file, you must specify the compression scheme in the Content-Type field of the request header. For example, you must declare the compression scheme list in the HTTP request sent by the client as follows:

Accept-Encoding: gzip, deflate

The server uses the specified compression scheme , which is indicated in the Content-Encoding field:

Content-Encoding: gzip

Did you find the above information helpful?

Unhelpful
Mostly Unhelpful
A little helpful
Helpful
Very helpful

What might be the problems?

Insufficient
Outdated
Unclear or awkward
Redundant or clumsy
Lack of context for the complex system or functionality

More suggestions

0/200

Please give us your feedback.

Submitted

Thank you for your feedback.

问题反馈