10-05-2018 01:41 AM
Hi
I am new, like most of us, to Labview NXG and I have a simple question : I want to make a webpage with some simple calculations. I need that the user provides his own data in a simple ASCII file that can be uploaded from his computer. How to do that in WebVi ? I don't see any "file management" vi
Thanks
Solved! Go to Solution.
10-16-2018 04:30 AM
Hi nitad54448,
There is no "file management" VI for now but you can change the HTML code of your WebVI to do that.
Try to include this code :
https://stackoverflow.com/a/29176118
And don't forget to build the application to have the .html which corresponds to your WebVI.
Have a nice day.
10-19-2018 07:36 AM
Hi
Thanks for the answer.
OK, I understood from the NXG presentations that we don't need a web programmer anymore. Is there any plan to add "file management" ? Otherwise, for reading google maps and this type of software that is presented with Nxg, I can use wordpress (easier... and much cheaper )
N
10-19-2018 03:47 PM
Can you elaborate more?
What is in the text file you want to upload (small file with configuration constants? large data file?) and
What you want to do in the WebVI if you could upload it (data visualization? filter data?) and
Do you also need the ability to generate and download a results file?
10-19-2018 03:54 PM
Hi
Yes, something like that. I want to read an ASCII file with some XY data, then smooth, show,.. calculate (like fitting...) then save the results (or at least print it on the screen). The file format might change from time to time so adding html code for each case it's impossible.
N
06-08-2019 03:58 AM
Hi
The latest NXG allows ASCII file reading/upload on web ?
thanks
06-12-2019 08:08 AM
Hi nitad54448,
It isn't built in functionality but I have an example that allows you upload a text file into a WebVI and returns the document as a string by using a JavaScript Library Interface (JSLI) document. I will post it. What version of LabVIEW NXG are you using?
Also, I don't know if you saw the WebVI GitHub example but it is a good source for ideas:
https://github.com/ni/webvi-examples
Thanks,
Frank
06-17-2019 03:27 PM
Hi nitad54448,
Please see the attached example project. It is saved in LabVIEW NXG 3.1.1, and uses the NXG Web Module.
I created this example by doing these steps:
1. Open HTML Editor and add an input button and make invisible in the <div class="ni-front-panel-wrapper"... </div>
<input type="file" id="myFile" style="display: none;">
2. Add JSLI node in its own Library component. Add the functions in the OpenFileWebVI.js to the JSLI node.
3. Add button to call OpenFileWebVI from JSLI, wait for file read to complete, and write text to String indicator.
A couple other notes:
This example works in Chrome and Opera (doesn't currently work in Edge or IE)
Please let me know if you have questions.
Thanks,
Frank
06-19-2019 04:39 AM
Thanks for your help Frank is a very god job!
I using your library and it works as expected.
Do you maybe have a similar library for write/download file?
Thanks in advance
Tiziana
06-19-2019 06:06 PM
Hi pirulla72,
Thanks! Great, I am happy to hear that it worked.
I don't have an example for write/download a file but I will try to work one in the next few days. If you are feeling motivated to try and add this functionality with the JSLI, these two links seem helpful:
How to create a file in memory for user to download, but not through server?
http://jsfiddle.net/VBJ9h/319/
Thanks,
Frank