Hello!
I want to download the file from the node-red dashborad from a remote computer, into the download folder of it. Right now Im using an static IP but not when the product is launched. I have used the flow @Steve-Mcl posted here ( https://flows.nodered.org/flow/db68bd4934cf46f39e6e453a348bc419). I know there are similar threads around the forum about the same topic, but I don´t get to find the right answer. I have tried it but when I press the link, a blank page opens with {}, but nothing happens. Probably I just need to fill something up but I really don´t know what.
The flow I constructed it´s the following:
[{"id":"7b63b1a9.f2278","type":"tab","label":"Flow 2","disabled":false,"info":""},{"id":"3ec88aa3.2502c6","type":"csv","z":"7b63b1a9.f2278","name":"","sep":",","hdrin":"","hdrout":"once","multi":"mult","ret":"\\r\\n","temp":"","skip":"0","strings":false,"include_empty_strings":"","include_null_values":"","x":1510,"y":460,"wires":[["133ca772.428de9","f3645657.895c78"]]},{"id":"b40d6105.bccc4","type":"function","z":"7b63b1a9.f2278","name":"Extraer info para los desplegables.","func":"msg.topic = \"SELECT ID_pac,Nombre FROM Pacientes\"\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":340,"y":300,"wires":[["483bf186.b482e"]]},{"id":"483bf186.b482e","type":"mysql","z":"7b63b1a9.f2278","mydb":"2becde9d.a8a7b2","name":"","x":330,"y":360,"wires":[["43c10180.ac1ee"]]},{"id":"43c10180.ac1ee","type":"change","z":"7b63b1a9.f2278","name":"","rules":[{"t":"set","p":"options","pt":"msg","to":"$.payload.{Nombre:ID_pac}","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":480,"y":360,"wires":[["d9c3db67.055a28"]]},{"id":"296d6046.05bd4","type":"inject","z":"7b63b1a9.f2278","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"","payloadType":"str","x":250,"y":240,"wires":[["b40d6105.bccc4"]]},{"id":"d9c3db67.055a28","type":"ui_dropdown","z":"7b63b1a9.f2278","name":"Desplegable de pacientes","label":"Paciente:","tooltip":"","place":"Select option","group":"a7de1769.1bc388","order":3,"width":0,"height":0,"passthru":false,"multiple":false,"options":[{"label":"","value":0,"type":"num"}],"payload":"","topic":"","x":750,"y":360,"wires":[["f0ff4b77.ad8f88"]]},{"id":"92f3f2c5.276f1","type":"ui_form","z":"7b63b1a9.f2278","name":"Selección de fechas","label":"","group":"a7de1769.1bc388","order":0,"width":0,"height":0,"options":[{"label":"Inicio:","value":"ini","type":"date","required":true,"rows":null},{"label":"Final:","value":"fin","type":"date","required":false,"rows":null}],"formValue":{"ini":"","fin":""},"payload":"","submit":"submit","cancel":"cancel","topic":"","x":740,"y":460,"wires":[["f0ff4b77.ad8f88"]]},{"id":"f0ff4b77.ad8f88","type":"join","z":"7b63b1a9.f2278","name":"","mode":"custom","build":"array","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":990,"y":420,"wires":[["cdb8b55f.9ac2e8","47e78e58.8c0dd"]]},{"id":"cdb8b55f.9ac2e8","type":"function","z":"7b63b1a9.f2278","name":"prueba","func":"var idp = msg.payload[0];\n\n\nmsg.topic = \"SELECT * FROM Sensores WHERE ID_and_s IN (SELECT ID_and FROM Andadores WHERE ID_pac = \"+idp+\")\";\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1220,"y":420,"wires":[["662ea2b7.6c556c"]]},{"id":"662ea2b7.6c556c","type":"mysql","z":"7b63b1a9.f2278","mydb":"2becde9d.a8a7b2","name":"","x":1390,"y":380,"wires":[["3ec88aa3.2502c6"]]},{"id":"133ca772.428de9","type":"file","z":"7b63b1a9.f2278","name":"","filename":"","appendNewline":true,"createDir":false,"overwriteFile":"true","encoding":"none","x":1530,"y":540,"wires":[["afafe7e6.c13188"]]},{"id":"4fab1e76.22975","type":"function","z":"7b63b1a9.f2278","name":"Set base path","func":"//restrict to c:\\temp\\\nvar basePath = \"c:\\\\temp\\\\\";\nvar filename = msg.req.params.fn;\n\n\nif(filename.includes(\"..\\\\\")){\n msg.payload = \"Illegal file path\";\n msg.statusCode = 405;//not allowed\n return [null, msg];//fire output 2\n} else if(filename.includes(\"../\")){\n msg.payload = \"Illegal file path\";\n msg.statusCode = 405;//not allowed\n return [null, msg];//fire output 2\n} \n//TODO: add more checks\n\nmsg.filename = basePath + filename;\nreturn [msg, null];//fire output 1\n\n\n","outputs":2,"noerr":0,"initialize":"","finalize":"","x":1320,"y":560,"wires":[["133ca772.428de9"],["afafe7e6.c13188"]]},{"id":"afafe7e6.c13188","type":"http response","z":"7b63b1a9.f2278","name":"","statusCode":"","headers":{},"x":1670,"y":620,"wires":[]},{"id":"d42c4a68.7d5b58","type":"catch","z":"7b63b1a9.f2278","name":"","scope":null,"uncaught":false,"x":1140,"y":660,"wires":[["87bb4e8.e7cd7b","a80a28e9.136668"]]},{"id":"87bb4e8.e7cd7b","type":"function","z":"7b63b1a9.f2278","name":"Set 404","func":"msg.payload = msg.error;\nmsg.statusCode = 404;//resource not found\nreturn msg;","outputs":1,"noerr":0,"x":1520,"y":660,"wires":[["afafe7e6.c13188"]]},{"id":"a80a28e9.136668","type":"debug","z":"7b63b1a9.f2278","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":1170,"y":700,"wires":[]},{"id":"fc3512b8.8d883","type":"ui_template","z":"7b63b1a9.f2278","group":"a7de1769.1bc388","name":"ui_temlplate - present download links on dashboard","order":0,"width":0,"height":0,"format":"<div >\n <a href=\"/files/log.log\">HAZ CLICK PARA DESCARGAR</a>\n</div>","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":false,"templateScope":"local","x":1430,"y":760,"wires":[[]]},{"id":"24ef48e2.7bc1d8","type":"http in","z":"7b63b1a9.f2278","name":"","url":"/files/:fn","method":"get","upload":false,"swaggerDoc":"","x":1150,"y":580,"wires":[["4fab1e76.22975"]]},{"id":"f3645657.895c78","type":"debug","z":"7b63b1a9.f2278","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1670,"y":420,"wires":[]},{"id":"9f6a1492.235998","type":"ui_toast","z":"7b63b1a9.f2278","position":"dialog","displayTime":"2","highlight":"","sendall":false,"outputs":1,"ok":"OK","cancel":"","raw":true,"topic":"DATOS EXTRAIDOS DE LA BASE DE DATOS.","name":"","x":1230,"y":300,"wires":[[]]},{"id":"47e78e58.8c0dd","type":"change","z":"7b63b1a9.f2278","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"Haz click en el enlace para descargar.","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1100,"y":360,"wires":[["9f6a1492.235998"]]},{"id":"2becde9d.a8a7b2","type":"MySQLdatabase","z":"","name":"","host":"127.0.0.1","port":"3306","db":"test","tz":""},{"id":"a7de1769.1bc388","type":"ui_group","z":"","name":"DESCARGAR DATOS A EXCEL:","tab":"8cc1fd64.8863","order":4,"disp":true,"width":"12","collapse":false},{"id":"8cc1fd64.8863","type":"ui_tab","z":"","name":"Interacción con los datos","icon":"dashboard","disabled":false,"hidden":false}]
It should be pretty easy to solve, I just don´t know where to look at.
Thanks in advance!