cURL error when uploading a local file to

I need to send a local file to the File.IO service. I can do it by using curl directly in Terminal, but the exact same command in the Execute Shell Script inside KM doesn't work, returning this error:

Execute a Shell Script failed with script error: curl: (26) Failed to open/read local data from file/application. Macro “Upload file to” cancelled (while executing Execute Shell Script).

I initially thought it could be a macOS security issue, but even after adding KeyboardMaestro Engine and curl to have full disk access, the error persists. Removing the double quotes doesn't help either.

Any help?

Upload file to (25 KB)

Keyboard Maestro Export

I believe your mistake is that you can't use %Variable%VarName% in that box, you have to pass your variable using the "$KMVAR_VarName" syntax.

Also, there are some complexities when using quotes. I see you are using double quotes. Quotes have often been issues that I've struggled with. If you still have problems after making this change, tell us, and we'll fix it.

I had no idea variables were different in shell scripts, which seems logical in hindsight. Worked 100%.

Thanks a lot, Airy.

One of the clues that could have told you that you can't use tokens is that there is no token menu pull down arrow in the action. In actions that support tokens, I think there's always a menu that lets you enter them using a menu.

1 Like

This will upload the current Finder selection to, extract the download link from the script output and copy it to the clipboard:

Upload to (39 KB)

Macro screenshot