• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Panel doesn't open a download file dialog

Community Beginner ,
May 03, 2019 May 03, 2019

Copy link to clipboard

Copied

In my panel I download a file via a nodeJS URL. When I test this page via my browser, it visits the URL, downloads the file to the server, and then opens a filedialog window to ask you to place it.

script.js

////////////////////

// TODO: DOWNLOADING TEST //

////////////////////////

let btnDownload = document.getElementById("btnDownload");

btnDownload.addEventListener('click', function () {

window.location.href = 'http://localhost:3000/downloadmedia?productionid='+productionId+'&mediaid='+mediaId;

}

The nodeJS server code

// define a route to download a file

app.get('/downloadmedia/', async (request, response) => {


//Setup API client & connection

     //...

// Downloading file to server via API

//...

console.log("Downloading file to __dirname + /temp/: " + __dirname + "/temp/");

await mediaObject.download(__dirname + '/temp/');//Download file and place in temp folder


let file = mediaObject.structuredDescription.fileName; //mediaobject filename

console.log("Downloaded : " + mediaObject.structuredDescription.fileName);

let fileLocation = __dirname + "\\temp\\" + file; //Complete path

console.log("FileLocation = " + fileLocation);


//Send the download response, and browser asks user for location

response.download(fileLocation);

});

HOWEVER, when I click the same button but in the panel in Premiere Pro, the logs state that it still downloads the file correctly, but doesn't open a filedialog to ask the user for a location to place it to. How can I solve this?

Views

717

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
May 07, 2019 May 07, 2019

Copy link to clipboard

Copied

Sorry, potentially ignorant question: Where does the value for _dirname come from? It seems like that isn't getting set correctly, in the panel case.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
May 07, 2019 May 07, 2019

Copy link to clipboard

Copied

That should be part of Node.js

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
May 07, 2019 May 07, 2019

Copy link to clipboard

Copied

LATEST

But you'll need to modify it anyway, because (in the example above) it's downloading into the extension's own directory. That'll work okay for an unsigned panel while debugging, but modifying the contents of an extension's directory will invalidate its signature, and make it no longer load.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines