oracle-samples / vbcs-samples Goto Github PK
View Code? Open in Web Editor NEWSamples Applications for Visual Builder Cloud Service
Home Page: https://cloud.oracle.com/visual-builder
License: Other
Samples Applications for Visual Builder Cloud Service
Home Page: https://cloud.oracle.com/visual-builder
License: Other
Hi..i am working on mobile application. i have created an endpoint for uploading image on oracle cloud . when i am uploading images using Action chain it is working fine but i have to upload file using JS .
These are the details of endpoint
i have to make POST request using JS . for making request i am using following code.
function readBinaryFile(filename) {
//fetching blob using
var reader = new FileReader();
reader.onloadend = function () {
var blob = dataURItoBlob(reader.result);
//Sending Post request on oracle visual builder endpoint using fetch
const response = await fetch(url, {
method: 'POST',
body: blob,
headers: {
'content_type': 'image/jpg',
'title':filename
}
});
if(response.ok){
confirm("Response Ok");
confirm(response.text());
}else{
confirm("Blob resquest result : ",response.text());
}
//Sending Post request on oracle visual builder endpoint using httprequest
var httpRequest = new XMLHttpRequest();
httpRequest.onreadystatechange = function() {
if (httpRequest.readyState == 4)
{
confirm(JSON.stringify(httpRequest));
}else{
confirm(JSON.stringify(httpRequest));
return false;
}
}
var beartoken="bear-token";
httpRequest.open('POST', url);
httpRequest.setRequestHeader('Authorization', 'Bearer '+beartoken);
httpRequest.setRequestHeader('content-type', 'image/jpg');
httpRequest.send(blob);
}
reader.readAsDataURL(file);
}, onErrorReadFile);
}
function dataURItoBlob(dataURI) {
var arr = dataURI.split(','), mime = arr[0].match(/:(.*?);/)[1];
return new Blob([atob(arr[1])], {type:mime});
}
Response Received
I have also tried to write code in html for sending post request but i am getting following error but getting following error :
Access to XMLHttpRequest at 'https://url/test/gallery/images' from origin 'null' has been blocked by CORS policy: Request header field access-control-allow-origin is not allowed by Access-Control-Allow-Headers in preflight response.
i am using following code for making request using javascript in html page
Html
<input type='file' accept='image/*' onchange='openFile(event)'><br>
<img id='output'>
Javascript
var openFile = function(event) {
var input = event.target;
var reader = new FileReader();
reader.onload = function(){
var dataURL = reader.result;
var output = document.getElementById('output');
output.src = dataURL;
var blob = dataURItoBlob(reader.result);
var filename = "testing_blob";
var beartoken = "token";
const response = fetch('url', {
method: 'POST',
body: blob, // string or object
headers: {
'content_type': 'image/png',
'title':filename,
'Access-Control-Allow-Origin':'*',
'Authorization': 'Bearer '+beartoken
}
});
sendImageRequest("url",blob);
};
reader.readAsDataURL(input.files[0]);
};
function dataURItoBlob(dataURI) {
var arr = dataURI.split(','), mime = arr[0].match(/:(.*?);/)[1];
return new Blob([atob(arr[1])], {type:mime});
}
function sendImageRequest(url="",datatosend){
var httpRequest = new XMLHttpRequest();
httpRequest.onreadystatechange = function() {
if (httpRequest.readyState == 4)
{
console.log(JSON.stringify(httpRequest));
return true;
}else{
console.log(JSON.stringify(httpRequest));
return false;
}
}
var beartoken="xx";
httpRequest.open('POST', url);
httpRequest.setRequestHeader('Authorization', 'Bearer '+beartoken);
httpRequest.setRequestHeader('content-type', 'image/jpg');
httpRequest.setRequestHeader('Access-Control-Allow-Origin','*');
httpRequest.send(datatosend);
}
Question :
Hi, we are using vbcs 2104 version with JET 9.2 and we are receiving console logs like this
Your CSS file is compatible with JET version undefined, but you are using JET version 9.2.6.
Please update your CSS to match the version of JET being used.
We are using ApplicationsCloudUI version 4.0.0
I am working on a mobile app . i have to create a drop down list (Select One) . i have to disable first option when user click on list . Suppose drop down contains following options
Hi i'm trying to get the ApplicationsCloudUITheme 6.0 to use it in last vbs runtime, but I get an error when I run ojet restore command. From the error log file:
1 info using [email protected]
2 info using [email protected]
3 timing npm:load:whichnode Completed in 0ms
4 timing config:load:defaults Completed in 1ms
5 timing config:load:file:/usr/local/lib/node_modules/npm/npmrc Completed in 1ms
6 timing config:load:builtin Completed in 1ms
7 timing config:load:cli Completed in 1ms
8 timing config:load:env Completed in 0ms
9 timing config:load:file:/home/opc/visualbuilderthemes/vbcs-samples-master/ApplicationsCloudUITheme/ApplicationsCloudUIThemeSource/.npmrc Completed in 0ms
10 timing config:load:project Completed in 2ms
11 timing config:load:file:/home/opc/.npmrc Completed in 1ms
12 timing config:load:user Completed in 1ms
13 timing config:load:file:/usr/etc/npmrc Completed in 7ms
14 timing config:load:global Completed in 8ms
15 timing config:load:validate Completed in 0ms
16 timing config:load:credentials Completed in 1ms
17 timing config:load:setEnvs Completed in 0ms
18 timing config:load Completed in 16ms
19 timing npm:load:configload Completed in 18ms
20 timing npm:load:setTitle Completed in 0ms
21 timing config:load:flatten Completed in 2ms
22 timing npm:load:display Completed in 2ms
23 verbose logfile /home/opc/.npm/_logs/2021-12-09T15_13_03_422Z-debug-0.log
24 timing npm:load:logFile Completed in 3ms
25 timing npm:load:timers Completed in 0ms
26 timing npm:load:configScope Completed in 0ms
27 timing npm:load Completed in 24ms
28 timing arborist:ctor Completed in 0ms
29 silly logfile start cleaning logs, removing 3 files
30 timing idealTree:init Completed in 206ms
31 warn old lockfile
31 warn old lockfile The package-lock.json file was created with an old version of npm,
31 warn old lockfile so supplemental metadata must be fetched from the registry.
31 warn old lockfile
31 warn old lockfile This is a one-time fix-up, please be patient...
31 warn old lockfile
1729 verbose type system
1730 verbose stack FetchError: request to https://artifacthub-tip.oraclecorp.com/api/npm/npmjs-remote/zip-stream/-/zip-stream-4.1.0.tgz failed, reason: getaddrinfo ENOTFOUND artifacthub-tip.oraclecorp.com
1730 verbose stack at ClientRequest.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/minipass-fetch/lib/index.js:110:14)
1730 verbose stack at ClientRequest.emit (node:events:394:28)
1730 verbose stack at TLSSocket.socketErrorListener (node:_http_client:447:9)
1730 verbose stack at TLSSocket.emit (node:events:406:35)
1730 verbose stack at emitErrorNT (node:internal/streams/destroy:157:8)
1730 verbose stack at emitErrorCloseNT (node:internal/streams/destroy:122:3)
1730 verbose stack at processTicksAndRejections (node:internal/process/task_queues:83:21)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.