I ran into a problem: I needed to get an APK onto my Smart TV, and I didn’t have a USB stick around. So, I figured out a pretty neat (if I do say so myself) way to do it. Basically, I used a PHP built-in server and downloaded the APK through the TV’s browser. Here’s how it works…
First of all you need PHP installed.
1
2
3
$sudo apt install php php-common
Then, connect your PC to the same Wi-Fi network as your smartphone/TV. And find your PC’s IP address in this network
As you can see here 127.0.0.1 is common loop-back address and 192.168.100.111 is address that we’re looking for
Now you need to create a folder, and put files that you want to share there, eg
hello-world.txt
test.apk
Then navigate to this folder and run PHP built-in server like
1
2
3
$sudo php-S192.168.100.111:80
(!) Avoid this on untrusted networks (like cafes), as anyone could access your shared files through your web server. Or at least use some random port instead of 80.
After that you will see that the server has started
And now you just need to go to your TV and navigate to this address by using your IP address and file name, eg
http://192.168.100.111/hello-world.txt
http://192.168.100.111/test.apk
When you visit this links for the APK files the download dialog should appear and for the text document you will see something like this
If you face some issues check the window where you run your web server, it will contain the logs
And to stop your server just interrupt it with Ctrl+C or close the window.