I am trying to get the actual wix static url that is returned when a pdf file is successfully uploaded. Note, my upload button is set to type "Document". Here is my partial code:
$w("#btnUpload").startUpload() .then( (uploadedFile) => { $w("#textStatus").text = "Upload successful"; $w("#inputURL").value = uploadedFile.url; let url = $w("#inputURL").value; console.log("url: " + url);
I expected that uploadedFile.url would return the wix static url that I could then insert into a collection in a field of type document. It does successfully upload the file as confirmed in Media Manager, however, the above console log shows "url: wix: ".
So, why don't I see the full wix static url???
Problem solved. By checking the returned value immediately after the startUpload() call instead of first putting the value in a text field and then checking it..... the returned value is the full wix static url. Here is the one line of code I added: console.log("url: " + uploadedFile.url);
$w("#btnUpload").startUpload() .then( (uploadedFile) => { console.log("url: " + uploadedFile.url); $w("#textStatus").text = "Upload successful"; $w("#inputURL").value = uploadedFile.url; let url = $w("#inputURL").value; console.log("url: " + url);