销售电话: 1-800-867-1380
EN
此内容没有您的语言版本,但有英语版本。

Get File

The Get File operation reads or downloads a file from the system, including its metadata and properties.

The Get File request may be constructed as follows. HTTPS is recommended.

 

Method Request URI HTTP Version

GET

https://myaccount.file.core.windows.net/myshare/mydirectorypath/myfile

HTTP/1.1

Replace the path components shown in the request URI with your own, as follows:

 

Path Component Description

myaccount

The name of your storage account.

myshare

The name of your file share.

mydirectorypath

Optional. The path to the directory.

myfile

The name of the file.

For details on path naming restrictions, see Naming and Referencing Shares, Directories, Files, and Metadata.

The following additional parameters may be specified on the request URI.

 

Parameter Description

timeout

Optional. The timeout parameter is expressed in seconds. For more information, see Setting Timeouts for File Service Operations.

The following table describes required and optional request headers.

 

Request Header Description

Authorization

Required. Specifies the authentication scheme, account name, and signature. For more information, see Authentication for the Azure Storage Services.

Date or x-ms-date

Required. Specifies the Coordinated Universal Time (UTC) for the request. For more information, see Authentication for the Azure Storage Services.

Range

Optional. Return file data only from the specified byte range.

x-ms-range

Optional. Return file data only from the specified byte range. If both Range and x-ms-range are specified, the service uses the value of x-ms-range. If neither are specified, the entire file contents are returned. See Specifying the Range Header for File Service Operations for more information.

x-ms-range-get-content-md5: true

Optional. When this header is set to true and specified together with the Range header, the service returns the MD5 hash for the range, as long as the range is less than or equal to 4 MB in size.

If this header is specified without the Range header, the service returns status code 400 (Bad Request).

If this header is set to true when the range exceeds 4 MB in size, the service returns status code 400 (Bad Request).

The response includes an HTTP status code, a set of response headers, and the response body, which contains the contents of the file.

A successful operation returns status code 200 (OK).

For information about status codes, see Status and Error Codes.

The response for this operation includes the following headers. The response may also include additional standard HTTP headers. All standard headers conform to the HTTP/1.1 protocol specification.

 

Response Header Description

Last-Modified

Returns the date and time the file was last modified. The date format follows RFC 1123. For more information, see Representation of Date/Time Values in Headers. Any operation that modifies the directory or its properties updates the last modified time. Operations on files do not affect the last modified time of the directory.

x-ms-meta-name:value

A set of name-value pairs associated with this file as user-defined metadata.

Content-Length

The number of bytes present in the response body.

Content-Type

The content type specified for the file. The default content type is application/octet-stream.

Content-Range

Indicates the range of bytes returned if the client requested a subset of the file by setting the Range request header.

ETag

The ETag contains a value which represents the version of the file, in quotes.

Content-MD5

If the file has an MD5 hash and the request is to read the full file, this response header is returned so that the client can check for message content integrity.

If the request is to read a specified range and the x-ms-range-get-content-md5 is set to true, then the request returns an MD5 hash for the range, as long as the range size is less than or equal to 4 MB.

If neither of these sets of conditions is true, then no value is returned for the Content-MD5 header.

If x-ms-range-get-content-md5 is specified without the Range header, the service returns status code 400 (Bad Request).

If x-ms-range-get-content-md5 is set to true when the range exceeds 4 MB in size, the service returns status code 400 (Bad Request).

Content-Encoding

This header returns the value that was specified for the Content-Encoding request header.

Content-Language

This header returns the value that was specified for the Content-Language request header.

Cache-Control

This header is returned if it was previously specified for the file.

Content-Disposition

Returns the value that was specified for the x-ms-content-disposition header and specifies how to process the response.

The Content-Disposition response header field conveys additional information about how to process the response payload, and also can be used to attach additional metadata. For example, if set to attachment, Content-Disposition indicates that the user-agent should not display the response, but instead show a Save As dialog.

x-ms-request-id

This header uniquely identifies the request that was made and can be used for troubleshooting the request. For more information, see Troubleshooting API Operations.

x-ms-version

Indicates the version of the File service used to execute the request.

Accept-Ranges: bytes

Indicates that the service supports requests for partial file content.

Date

A UTC date/time value generated by the service that indicates the time at which the response was initiated.

The response body contains the content of the file.

Response Status:
HTTP/1.1 200 OK

Response Headers:
x-ms-type: File
x-ms-meta-m1: v1
x-ms-meta-m2: v2
Content-Length: 11
Content-Type: text/plain; charset=UTF-8
Date: Mon, 27 Jan 2014 22:49:18 GMT
ETag: "0x8CB171DBEAD6A6B"
Last-Modified: Mon, 27 Jan 2014 22:48:29 GMT
x-ms-version: 2014-02-14
Server: Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0

Only the account owner may call this operation.

Calling Get File over a range that does not yet have content or that has been cleared returns zeros for those bytes.

If you call Get File with no range specified, the service returns the range of bytes up to the value specified for the x-ms-content-length header. For any ranges lacking content, the service returns zeros for those bytes.

A Get File operation is allowed 2 minutes per MB to complete. Operations that take longer than 2 minutes per MB on average will time out.

本文是否对您有所帮助?
(1500 个剩余字符)
感谢您的反馈
显示:
© 2014 Microsoft