Blank PDF upload on ajax call
<p>I am trying to upload PDF using ajax. Ajax call is sent to API (It's REST API which is written by client which I can't mention here.) which uploads file. Here is my code:</p>

<pre><code>    var settings = {
        beforeSend: function(xhrObj){
            xhrObj.setRequestHeader('Access-Control-Allow-Headers', '*');
            xhrObj.setRequestHeader("Cache-Control", "no-cache");
            xhrObj.setRequestHeader("Content-Type","application/octet-stream; charset=UTF-8");
            xhrObj.setRequestHeader("Accept","application/json;odata=verbose");
            xhrObj.setRequestHeader("Content-Transfer-Encoding", "base64");
            xhrObj.setRequestHeader("Authorization", self.makeAuth());
            xhrObj.setRequestHeader('Access-Control-Allow-Origin', '*');
        },
        async: false,
        processData: false,
        cache: false,
        crossDomain: true,
        url: url,
        method: "POST",
        data: file
    };

    $.ajax(settings).done(function (response) {
        alert(response);
    });
</code></pre>

<p>Response I am getting is:</p>

<pre><code>{"validRequest":true,"RequestMessage":"Success","EntityName":"Asset","EntityId":"004-e9cb6087-b365-4ab7-ba76-0ad65b4133e7","URL":"","APIVersion":"1.0.0"}
</code></pre>

<p>And after PDF upload call is transferred to get PDF link. Which is as follows:</p>

<pre><code>     var settings = {
        beforeSend: function(xhrObj){
            xhrObj.setRequestHeader("Content-Type","application/json");
            xhrObj.setRequestHeader("Accept","application/json");
            xhrObj.setRequestHeader("Authorization", self.makeAuth());
        },
        "async": true,
        "crossDomain": true,
        "url": url,
        "method": "POST",
        data: JSON.stringify({
            "CampaignName":"",
            "AssetType":"PDF",
            "Location":"Existing",
            "AssetId":assetId,
            "WebLink":"",
            "PDFName": fileName,
            "EmailAddress":email,
            "Notifications":"",
            "AssetName":AssetName,
            "AllowDownload":download_pdf,
            "ExternalEmailId": external_email_id
        })
    };

    $.ajax(settings).done(function (response) {
        alert(response);
    });
</code></pre>

<p>This call giving me response as:</p>

<pre><code>{"validRequest":true,"RequestMessage":"link_to_pdf","EntityName":"QuickCampaign","EntityId":"015-95f14ab4-f249-4bf5-87d4-d52ce5098c6a","URL":"","APIVersion":"1.0.0"}
</code></pre>

<p>I am not getting why it is uploading blank PDF. Please help</p>