Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>With much help from Tal at Cloudinary, I have reached success! I'll recap the solution:</p> <ol> <li><p>Do not instantiate Cloudinary's library in $(document).ready(), instead just plug it in directly within script section</p> <pre><code> &lt;script type="text/javascript"&gt; $.cloudinary.config({"api_key":"&lt;key&gt;","cloud_name":"&lt;cloud_name&gt;"}); </code></pre></li> <li><p>Instantiate the formData with the FileUpload widget, this ensures fileUpload<br> loads your json send params (it's a timing issue).</p> <pre><code> $('.cloudinary-fileupload').fileupload({ formData : &lt;unescaped json params&gt;, dropZone: $('.sceneUpBtn'), dataType: 'json', done: function (e, data) { $.each(data.result.files, function (index, file) { $('&lt;p/&gt;').text(file.name).appendTo('#filename'); }); }, progressall: function (e, data) { var progress = parseInt(data.loaded / data.total * 100, 10); $('.sceneUpBar').css('width',progress + '%'); } }); </code></pre></li> <li><p>Match signature params to json params sent to server. In Apex sign and return json as such:</p> <pre><code>public String getCloudinarySig() { Datetime d = datetime.now(); Long uxtime = d.getTime() / 1000; //epoch unix time method in force.com String apisec = '&lt;secret&gt;'; String serial = 'callback=&lt;cors url&gt;&amp;timestamp=' + uxtime + apisec; //Signature needs params here need to match json params below Blob sha = Crypto.generateDigest('SHA1', Blob.valueOf(serial)); //Sha1 digest String sig = EncodingUtil.convertToHex(sha); //Hex conversion String jsoSerial = '{'; jsoSerial += '"api_key":"&lt;key&gt;",'; //these json params need to match signature params above jsoSerial += '"&lt;CORS_url&gt;",'; jsoSerial += '"signature":"' + sig + '",'; jsoSerial += '"timestamp":'+ uxtime; jsoSerial += '}'; return jsoSerial; </code></pre> <p>}</p></li> </ol> <p>Happy to answer any questions...</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload