Push a file to your Smartphone

This is a quick tip. If you need to push a notification to your smartphone, or even send a file, I recently stumbled upon "Pushbullet".
I was looking for a solution to send a file (with automatic download) to my phone, via bash script on my raspberry pi. I've been using pushover for a while, but as far as I know, it doesn't support files

I have read the Pushbullet API, and came to realise that sending a file have 3 steps

1. Getting credentials to send the file
2. Upload the file to a remote server
3. Send a notification of "file" type with the download url

Of course, you can do 1 and 2 youself if you have access to a place which stores the file (I also managed to send a dropbox download link)

You need to sign up for Pushbullet via web, to get the api key, and also install the app on your smartphone (obviously)

So here is the bash script (It's not elegant - but it works)

You need to have cUrl and Python installed on your system
(Python isn't a must - you can alter the script if you wish to avoid it)


# Argument 1: file name (example: music.mp3)


FILENAME=$(basename ${1})
FILEDIR=$(dirname ${1})
FILETYPE=$(file -bi ${1} | cut -d';' -f1)

echo File: ${1}, Type: ${FILETYPE}


echo Getting permission...

eval $(curl -s -u ${APIKEY}: https://api.pushbullet.com/v2/upload-request -d \
                             file_name=${FILENAME} -d file_type=${FILETYPE} | python -m json.tool | \
                             sed 's/": /=/g' | tr -d ' ' | sed 's/,$//g' | sed 's/^"//g' | \
                             tr -d '}' | tr -d '{' | sed 's/data=//g' | sed '/^$/d' | \
                             sed 's/^/export /g'  | sed 's/content-type/content_type/g')

echo Uploading file ...

curl -O --progress-bar -i ${upload_url} \
  -F awsaccesskeyid=${awsaccesskeyid} \
  -F acl=${acl} \
  -F key=${key} \
  -F signature=${signature} \
  -F policy=${policy} \
  -F content-type=${content_type} \
  -F file=@${FILENAME} \

echo Sending Notification ...
curl -u ${APIKEY}: https://api.pushbullet.com/v2/pushes -d type=file -d file_name=${FILENAME} -d file_type=${FILETYPE} -d file_url=${file_url}

cd ${CURDIR}

Hope you find this useful. Enjoy

Feel free to ask questions. I will answer, if I know


  • Akos

    No Questions...everything works great!!!!

  • help me push


    I got: curl: Remote file name has no length!.
    curl: try 'curl --help' or 'curl --manual' for more information

    The message reach my device, but the file can't be downloaded

    (403 Forbidden
    Code: AccessDenied
    Message: Access Denied)

  • At which step does this happen?

  • Ali Hashmi

    hi! how can i contact you directly arnon? i want some help regarding my project. please

  • You can email me, the address is in the "about" page