Forum Discussion

leandropoblet's avatar
leandropoblet
Frequent Contributor
11 years ago
Solved

Read content of a stored file

Hi there,



I'm trying to read the content of a file which for my purposes has to be stored in the project.



Now the thing is it woudn't actually read it saying "Type mismatch" (which is a bit ridiculous since I'm storing a file and trying to read a file)



var storedFileContent = aqFile["ReadWholeTextFile"](storedFile, aqFile["ctUTF8"]);



Any suggestions?



Thanks in advance,

Leandro
  • Hi Leandro,



    What value does the storedFile variable have? It must be the path to the file on the disk.



    If your file is in Stores > Files, you can get its path like this:



    var storedFile = Files["FileNameByName"]("mystoredfile");



    If the file is in the project folder, you can use the following:



    var storedFile = Project["Path"] + "filename.txt";

2 Replies

  • Hi Leandro,



    What value does the storedFile variable have? It must be the path to the file on the disk.



    If your file is in Stores > Files, you can get its path like this:



    var storedFile = Files["FileNameByName"]("mystoredfile");



    If the file is in the project folder, you can use the following:



    var storedFile = Project["Path"] + "filename.txt";

  • leandropoblet's avatar
    leandropoblet
    Frequent Contributor
    Hi Helen,



    Thanks for your reply.

    The first option is the one I was looking for.



    I'm gonna try and see the results.



    Cheers