Unity Web Request Creating Upload Handlers
Send request body data to a server using the UploadHandlerRaw and UploadHandlerFile upload handlers.
読み終わるまでの所要時間 3 分最終更新 1ヶ月前
現在使用できるアップロードハンドラーは、 と の 2 種類です。
UploadHandlerRawUploadHandlerFileUploadHandlerRawUnityWebRequestNativeArrayUploadHandlerFileUpload Handler は、文字列 Content Type も受け取ります。この文字列は、UnityWebRequest 自体に ヘッダーを設定しない場合に、UnityWebRequest の ヘッダーの値として使用されます。UnityWebRequest オブジェクトに ヘッダーを手動で設定した場合は、Upload Handler オブジェクトの は無視されます。
Content-TypeContent-TypeContent-TypeContent-TypeUnityWebRequest または のいずれかに を設定しない場合、システムはデフォルトで の を設定します。
UploadHandlerContent-Typeapplication/octet-streamContent-TypeUnityWebRequestdisposeUploadHandlerOnDispose例
byte[] payload = new byte[1024];// ... fill payload with data ...UnityWebRequest wr = new UnityWebRequest("https://www.mysite.com/data-upload");UploadHandler uploader = new UploadHandlerRaw(payload);// Sends header: "Content-Type: custom/content-type";uploader.contentType = "custom/content-type";wr.uploadHandler = uploader;