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

Using File.openDialog with javascript

New Here ,
Dec 19, 2017 Dec 19, 2017

Hi,

i want to give users the chance to open things like powerpoint or videos directly by clicking a button in my pogramm.

I know that i can use something like this

function open_File()

{

window.open("myshow.pptx","","height=400,width=400,menubar=0,resizable=0,scrollbars=0,status=0,titlebar=0,toolbar=0,left=0,top=0");

}

but how can i manage to let the user choose a file from his pc? I thought of using File.openDialog, safe the file path as an variable and open it. But right now i didnt manage to work with File.openDialog. Hoping for some advices.....

The Powerpoints and so on don't need to start in animate,

Greetings

Frank

2.6K
Translate
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
Community Expert ,
Dec 19, 2017 Dec 19, 2017
Translate
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
LEGEND ,
Dec 19, 2017 Dec 19, 2017

So, once you get the path to the file on the user's local drive... what exactly do you intend to do with it?

Translate
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
New Here ,
Dec 22, 2017 Dec 22, 2017

Thanks for the link.

I solved the problem on another way ..

var file = document.getElementById("File");

file.type = "file";

this.btn_File.addEventListener("click", getFile.bind(this));

function getFile()

{

file.click();

var Filepath = file.value;

var Filname = Filepath.substr(Filepath.lastIndexOf('\\')+1,Filepath.lastIndexOf('.')+1);

if (Filname != 0)

{window.open("ppt/"+Filname,"","height=400,width=400,menubar=0,resizable=0,scrollbars=0,status=0,titlebar=0,toolbar=0,left=0,top=0");

}

}

i get the path, extrude the filename and open it with a programm used by the pc.

Next step will be to make an own input file component, so i can use it right from the start without the type change.

I know that the file must be in a special folder, buts thats totally ok for my purpose.

Translate
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
LEGEND ,
Dec 22, 2017 Dec 22, 2017
LATEST

Why would someone use a web page to open files on their own computer? What's the use case here?

Translate
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