Download file in local network

The title says it all. it's only downloading from the local device but other device in network can't download. On window, i shared folder with full controlling. i'm newbie.Help me.Thanks

[{"id":"4a71705a.a2948","type":"tab","label":"Flow 2","disabled":false,"info":""},{"id":"b673ed7c.9e8a5","type":"comment","z":"4a71705a.a2948","name":"File Browser","info":"1) Update the default folder in the Init node\n2) Update the default folder in the Reset node as well\n3) You can duplicate the Reset nodes and use them as saved shortcuts\n4) Check the Convert Timestamps function node if you want to see your dates in a different format. I just used the Javascript toISOString format.\n5) The Graph button can read any CSV file which have any number of values, but the first column always contains a timestamp column with javascript timestamp of the data point.","x":150,"y":100,"wires":[]},{"id":"e99bad9f.12fbc","type":"fs-file-lister","z":"4a71705a.a2948","name":"Files","start":"","pattern":"*.*","folders":"*","hidden":false,"lstype":"files","path":true,"single":true,"depth":0,"stat":true,"showWarnings":false,"x":550,"y":200,"wires":[["ed7c1cb9.99881","32f688c8.9e9188"]]},{"id":"c3a7e538.db6c38","type":"inject","z":"4a71705a.a2948","name":"Init","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":0.1,"topic":"change","payload":"//DESKTOP-JE71OBK/Users/ThienPham/Documents/export","payloadType":"str","x":150,"y":160,"wires":[["3f20d8e9.7053e8"]]},{"id":"7e7f82a9.093ebc","type":"ui_button","z":"4a71705a.a2948","name":"","group":"160e81fb.f1c86e","order":1,"width":"2","height":"1","passthru":false,"label":"Refresh","tooltip":"","color":"","bgcolor":"","icon":"refresh","payload":"","payloadType":"str","topic":"refresh","topicType":"str","x":140,"y":200,"wires":[["3f20d8e9.7053e8"]]},{"id":"cfc044e4.613ab8","type":"ui_dropdown","z":"4a71705a.a2948","name":"File Selector","label":"","tooltip":"","place":"Select a file","group":"160e81fb.f1c86e","order":9,"width":"5","height":"1","passthru":false,"multiple":false,"options":[{"label":"","value":"","type":"str"}],"payload":"","topic":"","topicType":"str","x":950,"y":200,"wires":[["9638ea20.0ae6c8"]]},{"id":"ed7c1cb9.99881","type":"function","z":"4a71705a.a2948","name":"Format data","func":"// format the data for the dropdown\nmsg.options = [];\nfor (var i=0; i<msg.payload.length; i++) {\n    // This is a file\n    obj = {};\n    obj [msg.payload[i].name.replace(/^.*(\\\\|\\/|\\:)/, '')]=msg.payload[i].name;\n    msg.options.push(obj);\n}\nmsg.payload={};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":750,"y":200,"wires":[["cfc044e4.613ab8"]]},{"id":"a39cbb02.9e47b8","type":"ui_template","z":"4a71705a.a2948","group":"160e81fb.f1c86e","name":"","order":6,"width":"18","height":"6","format":"<div ng-bind-html=\"msg.payload\" height=\"400\" style=\"height: 400px;\"><br/>\n</div>\n\n","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":false,"templateScope":"local","x":1140,"y":260,"wires":[[]]},{"id":"f282df78.d23c5","type":"template","z":"4a71705a.a2948","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"<table width=\"100%\">\n    <tr><th>File Name</th><th>Size</th><th>Created</th><th>Changed</th></tr>\n    {{#payload}}\n        <tr>\n            <td><a href=\"/download?filename={{name}}\" target=\"blank\">{{fname}}</a></td>\n            <td>{{stat.size}}</td>\n            <td>{{stat.created}}</td>\n            <td>{{stat.changed}}</td>\n        </tr>\n    {{/payload}}\n</table>\n","output":"str","x":980,"y":260,"wires":[["a39cbb02.9e47b8"]]},{"id":"32f688c8.9e9188","type":"function","z":"4a71705a.a2948","name":"Convert timestamps","func":"for (var i=0; i<msg.payload.length; i++) {\n    msg.payload[i].stat.created = msg.payload[i].stat.created.toISOString().slice(0, 19).replace('T', ' ');\n    msg.payload[i].stat.changed = msg.payload[i].stat.changed.toISOString().slice(0, 19).replace('T', ' ');\n    msg.payload[i].stat.accessed = msg.payload[i].stat.accessed.toISOString().slice(0, 19).replace('T', ' ');\n    msg.payload[i].stat.statusChanged = msg.payload[i].stat.statusChanged.toISOString().slice(0, 19).replace('T', ' ');\n    msg.payload[i].fname = msg.payload[i].name.replace(/^.*(\\\\|\\/|\\:)/, '');\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":780,"y":260,"wires":[["f282df78.d23c5"]]},{"id":"74011f69.7650a","type":"ui_button","z":"4a71705a.a2948","name":"","group":"160e81fb.f1c86e","order":10,"width":"2","height":"1","passthru":false,"label":"Delete","tooltip":"","color":"","bgcolor":"","icon":"delete","payload":"","payloadType":"str","topic":"","topicType":"str","x":170,"y":360,"wires":[["bc0db599.081148"]]},{"id":"9f7309b3.6a07e8","type":"function","z":"4a71705a.a2948","name":"Get filename","func":"// Get the filename from the flow context\nlet filename = flow.get(\"fileselected\");\n\n// check, if the filename is undefined that means it does not exist yet, nothing is selected yet\n// return: do not output anything\nif (filename===undefined) {\n    return;\n}\n\n// return the filename to the file-in node to delete\nmsg.filename = filename;\n\nif (msg.filename.replace(/^.*(\\\\|\\/|\\:)/, '')[0]!==\".\") {\n    // Only do this if this is a file, we don't delete folders\n    // and delete the context/selection as we are deleting the file as well\n    flow.set(\"fileselected\");\n    return msg;\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","x":370,"y":420,"wires":[["bed446ab.8d7788"]]},{"id":"bed446ab.8d7788","type":"file","z":"4a71705a.a2948","name":"Delete file","filename":"","appendNewline":true,"createDir":false,"overwriteFile":"delete","encoding":"none","x":580,"y":420,"wires":[["e99bad9f.12fbc","984ef1eb.8433b"]]},{"id":"789376b2.efbf28","type":"http in","z":"4a71705a.a2948","name":"","url":"/download","method":"get","upload":false,"swaggerDoc":"","x":180,"y":560,"wires":[["5ba789aa.c7d8a8"]]},{"id":"f6257860.ce3108","type":"http response","z":"4a71705a.a2948","name":"","statusCode":"","headers":{},"x":970,"y":560,"wires":[]},{"id":"5ba789aa.c7d8a8","type":"function","z":"4a71705a.a2948","name":"Get the file name","func":"msg.filename = msg.req.query.filename;\nmsg.contentdisposition = \"attachment; filename=\\\"\" + msg.req.query.filename.replace(/^.*(\\\\|\\/|\\:)/, '') + \"\\\"\";\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":430,"y":560,"wires":[["bf1eba25.791bb8"]],"outputLabels":["Folder selected"]},{"id":"bf1eba25.791bb8","type":"file in","z":"4a71705a.a2948","name":"","filename":"","format":"","chunk":false,"sendError":false,"encoding":"none","x":620,"y":560,"wires":[["a46a3482.0280b8"]]},{"id":"a46a3482.0280b8","type":"change","z":"4a71705a.a2948","name":"Set Headers","rules":[{"t":"set","p":"headers","pt":"msg","to":"{}","tot":"json"},{"t":"set","p":"headers.content-type","pt":"msg","to":"text/csv","tot":"str"},{"t":"set","p":"headers.Content-Disposition","pt":"msg","to":"contentdisposition","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":790,"y":560,"wires":[["f6257860.ce3108"]]},{"id":"12eb2014.2c5b2","type":"ui_button","z":"4a71705a.a2948","name":"","group":"160e81fb.f1c86e","order":11,"width":"2","height":"1","passthru":false,"label":"Graph","tooltip":"","color":"","bgcolor":"","icon":"show_chart","payload":"","payloadType":"str","topic":"","x":130,"y":680,"wires":[["a0f1482d.3f1ea8"]]},{"id":"a0f1482d.3f1ea8","type":"function","z":"4a71705a.a2948","name":"Get filename","func":"// Get the filename from the flow context\nlet filename = flow.get(\"fileselected\");\n\n// check, if the filename is undefined that means it does not exist yet, nothing is selected yet\n// return: do not output anything\nif (filename===undefined) {\n    return;\n}\n\n// return the filename to the file-in node to delete\nmsg.filename = filename;\n\nif (msg.filename.replace(/^.*(\\\\|\\/|\\:)/, '')[0]!==\".\") {\n    // Only do this if this is a file, we don't delete folders\n    return msg;\n}","outputs":1,"noerr":0,"x":300,"y":680,"wires":[["8d943a7f.8e8288"]]},{"id":"8d943a7f.8e8288","type":"file in","z":"4a71705a.a2948","name":"","filename":"","format":"utf8","chunk":false,"sendError":false,"encoding":"none","x":480,"y":680,"wires":[["e12e5f98.b5485"]]},{"id":"e12e5f98.b5485","type":"csv","z":"4a71705a.a2948","name":"","sep":",","hdrin":true,"hdrout":"","multi":"mult","ret":"\\n","temp":"","skip":"0","strings":true,"x":630,"y":680,"wires":[["304bbf8f.e1da4"]]},{"id":"16ec88f5.96ca57","type":"debug","z":"4a71705a.a2948","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1050,"y":640,"wires":[]},{"id":"304bbf8f.e1da4","type":"function","z":"4a71705a.a2948","name":"Format data for chart","func":"var chart = [{\n    \"series\":[],\n    \"data\":[],\n    \"labels\":[msg.filename]\n}];\n\n\n/*\nvar pressure = [];\nvar out2 = [];\n\nfor (var i=0; i<msg.payload.length; i++) {\n    pressure.push({\"x\":msg.payload[i].timestamp, \"y\":msg.payload[i].pressure});\n    out2.push({\"x\":msg.payload[i].timestamp, \"y\":msg.payload[i].out2*200});\n\n}\nchart[0].data.push(pressure);\nchart[0].data.push(out2);\n*/\n\nlet columns = 0;\n\nfor(var series in msg.payload[0]) {\n    if(series!==\"timestamp\") {\n        chart[0].series.push(series);\n        chart[0].data.push([]);\n        columns++;\n    }\n}\n\n\nfor (var j=0; j<msg.payload.length; j++) {\n   for(var i=0;i<columns;i++) {\n       chart[0].data[i].push({\"x\":msg.payload[j].timestamp, \"y\":msg.payload[j][chart[0].series[i]]});\n   } \n}\n\n\n\n\nmsg.payload = chart;\n\nreturn msg;","outputs":1,"noerr":0,"x":840,"y":680,"wires":[["736492ac.14087c","16ec88f5.96ca57"]]},{"id":"736492ac.14087c","type":"ui_chart","z":"4a71705a.a2948","name":"","group":"160e81fb.f1c86e","order":12,"width":"18","height":"6","label":"","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"outputs":1,"x":1040,"y":680,"wires":[[]]},{"id":"30b1081.452d3f8","type":"ui_toast","z":"4a71705a.a2948","position":"dialog","displayTime":"3","highlight":"","sendall":false,"outputs":1,"ok":"Yes","cancel":"No","raw":false,"topic":"","name":"Confirmation","x":550,"y":360,"wires":[["f77af291.00955"]]},{"id":"bc0db599.081148","type":"change","z":"4a71705a.a2948","name":"Set message","rules":[{"t":"set","p":"topic","pt":"msg","to":"Delete confirmation","tot":"str"},{"t":"set","p":"payload","pt":"msg","to":"Are you sure you want to delete this file?","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":350,"y":360,"wires":[["30b1081.452d3f8"]]},{"id":"f77af291.00955","type":"switch","z":"4a71705a.a2948","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"Yes","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":750,"y":360,"wires":[["9f7309b3.6a07e8"]]},{"id":"3f20d8e9.7053e8","type":"function","z":"4a71705a.a2948","name":"Folder handling","func":"let folder = context.get(\"folder\");\nif (folder===undefined) {\n    folder=\"/\";\n    context.set(\"folder\", folder);\n}\n\nlet hidden = context.get(\"hidden\");\nif (hidden===undefined) {\n    hidden=false;\n    context.set(\"hidden\", hidden);\n}\n\nif (msg.topic===\"up\") {\n    var the_arr = folder.split('/');\n    the_arr.pop();\n    folder=the_arr.join('/'); \n    context.set(\"folder\", folder);\n}\nif (msg.topic===\"change\") {\n    folder=msg.payload;    \n    context.set(\"folder\", folder);\n}\nif (msg.topic===\"hidden\") {\n    hidden=msg.payload;    \n    context.set(\"hidden\", hidden);\n}\n\nmsg.payload = {\"start\":folder, \"hidden\": hidden};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":340,"y":260,"wires":[["e99bad9f.12fbc","1df831ac.2707ae","984ef1eb.8433b"]]},{"id":"1df831ac.2707ae","type":"ui_text","z":"4a71705a.a2948","group":"160e81fb.f1c86e","order":4,"width":"9","height":"1","name":"","label":"Folder:","format":"{{msg.payload.start}}","layout":"row-left","x":540,"y":140,"wires":[]},{"id":"faaa31b0.eae9","type":"ui_button","z":"4a71705a.a2948","name":"","group":"160e81fb.f1c86e","order":3,"width":"2","height":"1","passthru":false,"label":"Up","tooltip":"","color":"","bgcolor":"","icon":"arrow_upwards","payload":"","payloadType":"str","topic":"up","x":150,"y":280,"wires":[["3f20d8e9.7053e8"]]},{"id":"88f9a0df.cead","type":"ui_button","z":"4a71705a.a2948","name":"","group":"160e81fb.f1c86e","order":8,"width":"2","height":"1","passthru":false,"label":"Open","tooltip":"","color":"","bgcolor":"","icon":"folder_open","payload":"","payloadType":"str","topic":"","topicType":"str","x":170,"y":480,"wires":[["a333dfa3.1dbba"]]},{"id":"a333dfa3.1dbba","type":"function","z":"4a71705a.a2948","name":"Change folder","func":"// Get the filename from the flow context\nlet folderselected = flow.get(\"folderselected\");\n\n// check, if the filename is undefined that means it does not exist yet, nothing is selected yet\n// return: do not output anything\nif (folderselected===undefined) {\n    return;\n}\n\nmsg.topic = \"change\";\nmsg.payload = folderselected;\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":380,"y":480,"wires":[["3f20d8e9.7053e8"]]},{"id":"cef359ca.a37398","type":"ui_button","z":"4a71705a.a2948","name":"","group":"160e81fb.f1c86e","order":2,"width":"2","height":"1","passthru":false,"label":"Reset","tooltip":"","color":"","bgcolor":"","icon":"autorenew","payload":"/home/pi","payloadType":"str","topic":"change","x":150,"y":240,"wires":[["3f20d8e9.7053e8"]]},{"id":"984ef1eb.8433b","type":"fs-file-lister","z":"4a71705a.a2948","name":"Folders","start":"","pattern":"*.*","folders":"*","hidden":false,"lstype":"directories","path":true,"single":true,"depth":0,"stat":true,"showWarnings":false,"x":560,"y":300,"wires":[["5f8f9003.ee604"]]},{"id":"c667b921.ee0d38","type":"ui_dropdown","z":"4a71705a.a2948","name":"Folder Selector","label":"","tooltip":"","place":"Select a folder","group":"160e81fb.f1c86e","order":7,"width":"5","height":"1","passthru":false,"multiple":false,"options":[{"label":"","value":"","type":"str"}],"payload":"","topic":"","topicType":"str","x":960,"y":300,"wires":[["69fbab6d.c48ea4"]]},{"id":"5f8f9003.ee604","type":"function","z":"4a71705a.a2948","name":"Format data","func":"// format the data for the dropdown\nmsg.options = [];\nfor (var i=0; i<msg.payload.length; i++) {\n    // This is a foler\n    obj = {};\n    obj [\"[\"+msg.payload[i].name.replace(/^.*(\\\\|\\/|\\:)/, '')+\"]\"]=msg.payload[i].name;\n    msg.options.push(obj);\n}\nmsg.payload={};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":750,"y":300,"wires":[["c667b921.ee0d38"]]},{"id":"9638ea20.0ae6c8","type":"change","z":"4a71705a.a2948","name":"Save selection","rules":[{"t":"set","p":"fileselected","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1260,"y":200,"wires":[[]]},{"id":"69fbab6d.c48ea4","type":"change","z":"4a71705a.a2948","name":"Save selection","rules":[{"t":"set","p":"folderselected","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1160,"y":300,"wires":[[]]},{"id":"93c4b013.5e69f","type":"ui_switch","z":"4a71705a.a2948","name":"","label":"Hidden","tooltip":"Show hidden files or not","group":"160e81fb.f1c86e","order":5,"width":"2","height":"1","passthru":false,"decouple":"false","topic":"hidden","topicType":"str","style":"","onvalue":"true","onvalueType":"bool","onicon":"check_box","oncolor":"#000000","offvalue":"false","offvalueType":"bool","officon":"check_box_outline_blank","offcolor":"#000000","animate":true,"x":140,"y":320,"wires":[["3f20d8e9.7053e8"]]},{"id":"7637f318.9af2bc","type":"file","z":"4a71705a.a2948","name":"","filename":"","appendNewline":true,"createDir":false,"overwriteFile":"true","encoding":"none","x":590,"y":480,"wires":[[]]},{"id":"160e81fb.f1c86e","type":"ui_group","name":"File Browser","tab":"b63d1f91.68095","order":1,"disp":true,"width":"18","collapse":false},{"id":"b63d1f91.68095","type":"ui_tab","name":"Files","icon":"dashboard","disabled":false,"hidden":false}]

It is best if you also share a screenshot of your flow so that people don't have to load the flow and potentially mess up their own flows just to understand what you are doing.

Also best to share what OS and version, node.js version and Node-RED version you are using.

I think you are on some version of Windows? Therefore probably trying to use a network share UNC name? \\name-or-ip-of-server\folder\name\filename.xxx and it is likely that whatever node you are using does not understand UNC names.

thank you for your help. i found my issue

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.