Skip to main content
1-Visitor
October 13, 2020
Question

How to obtain all the name of pdf into upload folder

  • October 13, 2020
  • 1 reply
  • 1644 views

Hi everyone, 

 

in my project I need to load a lot of file. 

I'm searching for a procedure able to: 

- read the name in 'app/resources/Uploaded/' + documentName + '.pdf'

- save documentName into a json file

 

In such way i could be able to launch the visualization of the file into 2d canvas, with a function like this one bind to a button that pass the parameter 'documentName': 

 

$scope.showDocumentation = function(documentName){
var anchor = document.createElement('a');
anchor.href = 'app/resources/Uploaded/'+documentName+'.pdf';
window.location.href = anchor.href;
};

With the json file I want to load the file without typing every single name with my fingers. 

 

Any suggestions?

 

1 reply

21-Topaz I
October 13, 2020

Hello @leonardosella ,

just to clarify:

- read the name in 'app/resources/Uploaded/' + documentName + '.pdf'  -> 

->>> in this case you want check the app/resources/Uploaded folder if an particular document is there ? Or you don’t know the name of the documents , and you want to do something like ... dir ...  or ls...  of the app/resources/Uploaded/ folder

- save document Name into a json file-   Where you want to save the json file?

If you want to change it locally back to the folder   app/resources/Uploaded/ - I do not believe that this is possible /allowed    . 

Or do you have other web. server where you want to save it.

Json information could be read from the app/resources/Uploaded/  folder but it could not be modified / modification only in session possible. Also, you can send the modified json data  to a web server or TWX server(thingworx)

1-Visitor
October 13, 2020

Hi @RolandRaytchev,

1. I want to check the /../Uploaded/ directory and access the name of the pdf files, I don't know this prefix;

2. I made a mistake, don't save into a json file, only save the name on documentName.pdf into an object. 

21-Topaz I
October 14, 2020

Thanks for the clarification.

to 1.) this is directly not part of the funcitonaltiy but there was discussion in the post : "Show all Files of a Folder" - I hope this could be helpfule

2.) Ok when you find the name there will be  no problem the modify a json object and update the name or insert the new name / or object  to the json list. Afterwards  you can upload it to server or TWX