You need to sign in to do that
Don't have an account?
Suman Kuch
XMLHttpRequest cannot load https://upload.box.com/api/2.0/files/content. Origin https://idrdev--c.cs41.visual.force.com is not allowed by Access-Control-Allow-Origin
Hi,
I'm developing an upload process from Salesforce to Box to upload files via CORS functionality but I'm failing to make calls to BOX and getting error "XMLHttpRequest cannot load https://upload.box.com/api/2.0/files/content. Origin https://idrdev--c.cs41.visual.force.com is not allowed by Access-Control-Allow-Origin." so could anyone of you please give me know the solution for this issue?
The Code I'm using to upload files to BOX is..
Thanks,
Suman K
I'm developing an upload process from Salesforce to Box to upload files via CORS functionality but I'm failing to make calls to BOX and getting error "XMLHttpRequest cannot load https://upload.box.com/api/2.0/files/content. Origin https://idrdev--c.cs41.visual.force.com is not allowed by Access-Control-Allow-Origin." so could anyone of you please give me know the solution for this issue?
The Code I'm using to upload files to BOX is..
<script type="text/javascript"> var script= document.createElement('script'); script.type= 'text/javascript'; script.src= '//cdnjs.cloudflare.com/ajax/libs/jquery/2.0.0/jquery.min.js'; document.head.appendChild(script); function fileUpload(recId) { Visualforce.remoting.Manager.invokeAction( '{!$RemoteAction.BoxUploadController.createBoxFolder}', recId, function(result, event){ if (event.status) { folderID = result.FolderID; Bearer = result.Bearer; // Get DOM IDs for HTML and Visualforce elements like this var file =document.getElementById('fileinput').files[0]; var form = new FormData(); var blob = new Blob([file], { type: file.type}); form.append('file',file, file.name); form.append('parent_id', folderID); var uploadUrl = 'https://upload.box.com/api/2.0/files/content'; var headers = { Authorization: 'Bearer '+Bearer }; $.ajax({ url: uploadUrl, crossOrigin: true, headers: headers, type: 'POST', processData: false, contentType: true, data: form }).complete(function ( data ) { console.log(data); }); } else if (event.type === 'exception') { document.getElementById("responseErrors").innerHTML = event.message + "<br/>\n<pre>" + event.where + "</pre>"; } else { } }, {escape: true} ); } </script>
Thanks,
Suman K