DEV Community 👩‍💻👨‍💻

Cover image for One-command file sharing with upload.express
Maxence Henneron
Maxence Henneron

Posted on

One-command file sharing with upload.express

In this short tutorial, I'm going to present the latest feature we implemented on upload.express: a one-command terminal file sharing.

If you want to upload a file in your current working directory, all you have to do is typing the following command:

curl --upload-file ./file_name.ext https://upload.express/upload/file_name.ext

It will return a link to the uploaded file.

Creating an alias

Remembering the curl command arguments can take a while. You can simplify the command by creating an alias in your ~/.bashrc or ~/.zshrc file.

Just append the following code at the end of the file:

upload() {
    if [ $# -eq 0 ]; then echo -e "No arguments specified. Usage:\necho upload /path/to/file.md"; return 1; fi
    curl --progress-bar --upload-file "$1" https://upload.express/upload/$(basename $1) | tee /dev/null;
}

alias upload=upload

You can now use the command upload file_path to share any file.

Top comments (4)

Collapse
 
sebo1000 profile image
Cockedey Sébastien

Guess I shouldn't have tried to follow the link in your picture 😅

Collapse
 
michaeltharrington profile image
Michael Tharrington (he/him)

LOL! So glad you pointed that out.

Collapse
 
paraparata profile image
paraparata

pardon me, but how to download the file with CLI from upload.express?

Collapse
 
maxencehenneron profile image
Maxence Henneron

It is currently not possible, but I'm working on a more advanced CLI that will implement this feature. I can ping you once completed

We are hiring! Do you want to be our Senior Platform Engineer? Are you capable of chipping in across sysadmin, ops, and site reliability work, while supporting the open source stack that runs DEV and other communities?

This role might just be for you!

Apply now