Download a file to the Server

Is it possible to download a file to the server from a URL? I.e thinking something along the lines of this function in PHP file_get_contents(‘http://www.example.com/’);

This custom module might work for you

@sid also created an option

API File Upload Action - NodeJS & PHP [Open Source]

1 Like

dang wish I could do this with asp…

Been trying to figure out how to automatically download a file from an API source. I have it working but you have to copy the url and then drop it into dropzone to get it to download…

Awesome thank you so much @mebeingken

1 Like

Hi, tried using this, but getting error:

{"status":"500","code":"MODULE_NOT_FOUND","message":"Cannot find module 'request'\nRequire stack:\n- /opt/node_app/extensions/server_connect/modules/custom_file_actions.js\n- /opt/node_app/lib/core/app.js\n- /opt/node_app/lib/core/middleware.js\n- /opt/node_app/lib/setup/routes.js\n- /opt/node_app/lib/server.js\n- /opt/node_app/index.js","stack":"Error: Cannot find module 'request'\nRequire stack:\n- /opt/node_app/extensions/server_connect/modules/custom_file_actions.js\n- /opt/node_app/lib/core/app.js\n- /opt/node_app/lib/core/middleware.js\n- /opt/node_app/lib/setup/routes.js\n- /opt/node_app/lib/server.js\n- /opt/node_app/index.js\n at Function.Module._resolveFilename (node:internal/modules/cjs/loader:1026:15)\n at Function.Module._load (node:internal/modules/cjs/loader:871:27)\n at Module.require (node:internal/modules/cjs/loader:1098:19)\n at require (node:internal/modules/cjs/helpers:108:18)\n at App.exports.write_binary (/opt/node_app/extensions/server_connect/modules/custom_file_actions.js:40:21)\n at App._exec (/opt/node_app/lib/core/app.js:608:57)\n at App.exec (/opt/node_app/lib/core/app.js:544:20)\n at App.define (/opt/node_app/lib/core/app.js:526:20)"}

I guess somewhere some paths need to be changed. Will look at the file and see if I can find it. Just want to make you aware in case you want to fix the repo.

Thanks

NEver mind - just saw you posted the new version. Thanks for this!