Those of us living in Apple’s golden cage know that the fruity phones offer a pretty decent user experience. But try rattling the bars, and you’ll find out that Cupertino has done a solid job of locking you into their system.

One of the nicer functionalities of iOS is Airdrop. This lets us transfer files between devices over Bluetooth. It’s as easy as sending a file by Signal. But disappointingly, it only works with Apple devices. This both a fact of life, and really stupid.1

For example, I sometimes find interesting ebooks on the internet. My ebook reader is in the non-aligned camp, because what I’m reading is honestly none of Jeff Bezos’ fucking business. When I find a book I like, e.g. on Project Gutenberg, I often download it to my phone.

So, how do I transfer that epub file to my ebook reader?

http to the rescue

I could just copy it to my computer, connect the ebook reader with a cable, and copy it over. This works, but it’s cumbersome: When I get time to read, I’ve usually just managed to tear myself away from the computer. So I don’t want to turn around and fire up the time-wasting box again.

Much better to waste time in a more interesting way! Turns out it’s really not hard to start a http server on my iPhone, direct the ebook reader’s browser to download the epub file from there.

(Of course, this works with literally any sort of file. Let’s just stick with my use case for now for simplicity’s sake.)

Important: This will only work if your iPhone and your ebook reader are on the same wifi network. If your reader doesn’t have wifi, then sorry, it’s cables for you.

Preparations

You only need to do this stuff the first time. We’re following these instructions.

On the iPhone:

  1. download the iSH app. It’s a Linux shell, more or less.
  2. start iSH, and install Python 3:

apk add python3

  1. open your Files app, and hit “Browse”. In the top right corner there’s a circle with three little dots in it. A menu pops up, and you select “Edit”. This will show you a bunch of places where your phone can store files, iSH among them. Make sure iSH has a green toggle.

=== ADDED ===

Instead of installing Python and then using the http.server package, you can also just install darkhttpd, like so (still in iSH):

apk add darkhttpd

and then run it with

darkhttpd .

The dot is for the current (root) folder. If you’re feeling fancy, use another path where your files are stored.

(Thanks jacksonchen666 for the pointer!)

=== end of addition ===

Oh, and download the epub file you want to transfer to your reader. It doesn’t matter where you get it from, nobody’s judging you.

Transferring files

  1. On your iPhone, figure out where the downloaded file is stored. Just open the Files app, click on “Recent”, and it’ll probably sit right at the top.
  2. Copy the epub file to iSH’s root directory:
    • Long press on the file > copy.
    • Then hit “Browse”, and under “Locations”, you should see “iSH”.
    • Tap on “iSH”, then on “root”
    • long press somewhere on the empty screen. A context menu pops up, and you select “paste”. That’s it.
  3. On your iPhone, open iSH and fire up the web server:

python3 -m http.server

If all is well, you should now get a message in iSH like “Serving HTTP on 0.0.0.0 port 8000”.

Do you see it? Congratulations, you’re running a web server on your phone!

But where, in network terms, is your phone? Let’s go find out your local IP address. On your iPhone:

  1. Open Settings
  2. Tap on “Wifi”. You’ll see the network you’re connected to. There’s a little “i” in a circle. Tap that, scroll down a bit, and you’ll see your phone’s local IP address. Mine is currently 192.168.178.47. Yours should look similar.

Now let’s transfer the file.

On your ebook reader, fire up the web browser. In the address bar, enter

http://< your IP address >:8000

for example

http://192.168.178.47:8000

Then hit “Enter”. You should now see a very plain directory listing that contains the epub file!

Just tap on the file to download it. My ebook reader decided to store it in its library and open it right away; I’m not sure how yours will do it. But you’ll figure it out.

Done!

Congratulations! You did it. That’s all. Repeat the steps from the “Transferring files” section as often as you like.

When you’re done, go to iSH on your phone, tap “^” and then “Z” to stop the server.

Of course, this process isn’t limited to ebooks. Open protocols like http are among the finer things in life, right up there with food and sex. Enjoy them!

You can just put any file in iSH’s root directory, and access it from any device on your network that speaks http.

Feedback, please

Did this work for you? Cool!

Oh, it didn’t work? Please let me know on the Fediverse, and I’ll see what I can do to help.


  1. I’m fully aware of how capitalism works. We’re writing from the user’s perspective here, ok? ↩︎