0

I am trying to do same sample request given in "https://developers.google.com/drive/v3/web/multipart-upload".

These is my latest request,

Accept:*/*
Authorization:Bearer <MY_AUTH_TOKEN>
Content-Type:multipart/form-data; boundary=----WebKitFormBoundaryFW5LVsbJxkVMM
Origin:http://app.128.199.85.9.nip.io:3000
Referer:http://app.128.199.85.9.nip.io:3000/

The request payload is,

------WebKitFormBoundaryFW5LVsbJxkVMM
Content-Disposition: form-data; name="metadata"

{"name":"file"}
------WebKitFormBoundaryFW5LVsbJxkVMM
Content-Disposition: form-data; name="data"; filename="2.jpg"
Content-Type: image/jpeg


------WebKitFormBoundaryFW5LVsbJxkVMM--

I need to make the Top header Content-type to "multipart/related boundary=". Then in the request payload parts, I need to make the first object have content-type of "application/json; charset=UTF-8". I need to make the second object have content-type of "image/jpeg".

How to do it with $.ajax?

My question is different from others because, I am getting different error. If I just use "multipart/form-data", it errors different. I need to use "multipart/related".

JMA
  • 974
  • 3
  • 13
  • 41
  • Possible duplicate of [Sending multipart/formdata with jQuery.ajax](http://stackoverflow.com/questions/5392344/sending-multipart-formdata-with-jquery-ajax) – Linda Lawton - DaImTo Mar 09 '17 at 07:20
  • be aware that using multipart to upload an image is not recommended. You should be using resumable upload. – pinoyyid Mar 09 '17 at 08:38
  • Can you post an answer here? I need to know how to use resumable upload in jquery.ajax. – JMA Mar 10 '17 at 04:38

0 Answers0