Showing results for 
Search instead for 
Did you mean: 
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Help us improve the PTC Community by taking this short Community Survey! X

get list o file from Uploaded


get list o file from Uploaded

is it possible to get a list of the files present in the resource/Uploaded folder by code ?





I have tried many example found on the web to adapt to the need.

For example this one :


But it is not working.

In Preview, we have this kind of error :


ionic.bundle.min.js:150 ReferenceError: require is not defined
at b.$scope.walk (app.js:231)
at app.js:253
at Object.<anonymous> (app.js:258)
at Object.invoke (ionic.bundle.min.js:75)
at S.instance (ionic.bundle.min.js:122)
at n (ionic.bundle.min.js:98)
at g (ionic.bundle.min.js:92)
at ionic.bundle.min.js:91
at Object.x.appendViewElement (ionic.bundle.min.js:471)
at Object.render (ionic.bundle.min.js:470)


It is due to this line in javascript code :

const fs = require('fs');

require is not available in clients, it is a server function.

More details here :


I have tried a third party solution by using requirejs


To load this third party library, I use the solution explained in this thread :


But finally, I didn't find the way to replace require method by the one provided in requirejs.


In Chrome, in Developper Tool, in Console when typing require or requirejs, same exception is still reported.

Even if the require.js is loaded in Sources tab, under preview-frame (xxx).


I think, this way is very close to have the result expected.

It just need more dig up.


Best regards,


Hi @Giuseppe_Fiore,

I think we have to check if this is really required. Because you can create the list manually. So you can go in the studio project direcotry<UserFolder>\Documents\VuforiaStudio\Projects\<projectName>\src\phone\resources\Uploaded

and start from there some script which will output to a file, which could be edited e.g. in json syntax. Later you can past this json list to javascript or to an service in thingworx . So that in runtime you can access to this list and if required load a file via the $https service ... something like:


 $http.get('app/resources/Uploaded/l-Creo 3D - TestFigure1.pvi').success(function(data, status, headers, config) { console.log("---->");console.warn(data); })
  .error(function(data, status, headers, config) {console.log("problem in the http ");})


The real question is : it is required that you need a dynamic generated list of the upload directory. I could currently not remember an case where the number of the files in the upload folder was changed during the runtime ... but not 100% sure 

For example I had a project where  some picture are generated dynamically but the handling of them was via thingworx services  inside a thingworx repository

I am developing an experience that must be maintained and expanded by the customer independently.
Since they don't know the environment, the idea was to filter the .pvz files and make the models available to load in a Dynamic list.
in this way the client will simply have to load only the .pvz file to use and republicate the experience.


How do you change the contet of the upload folder? And in which mode? : On the end device or in preview mode?

in preview Mode.


Ok this means you can start there an script (with some parameter like project name or folder location) which could list the upload folder and then the results could be written to json file. So you can read this json file in the angular script via the $http service.

But of course I agree , it will be more convenient , if there is a way to list this dynamically - this will be a better options. I will ask the dev team.

Top Tags