Skip to content

Download Files From Your Computer By Your Phone

Amin Zamani edited this page Sep 15, 2023 · 1 revision

The command python -m http.server 8000 is used to start a simple HTTP server on your computer, and it allows you to serve files from your computer to other devices on your local network. If you want to access this server from your phone, both your phone and your laptop need to be on the same local network (e.g., connected to the same Wi-Fi network).

Here's how you can connect your phone to the laptop's HTTP server using this command:

  1. Start the HTTP Server: Open your terminal or command prompt on your laptop, navigate to the directory where your files are located (or where you want to serve files from), and run the following command:

    python -m http.server 8000
    

    This will start the HTTP server on port 8000 by default. You can specify a different port number if you prefer.

  2. Find Your Laptop's IP Address: To connect your phone to your laptop, you need to know your laptop's local IP address. You can find this by running the following command on your laptop:

    • On Windows, use ipconfig in the command prompt and look for the "IPv4 Address" under your active network adapter.
    • On macOS or Linux, use ifconfig or ip addr in the terminal and look for the "inet" address associated with your network adapter (usually something like 192.168.x.x).
  3. Access the Server from Your Phone: On your phone, open a web browser and enter the following address:

    http://<your_laptop_ip>:8000
    

    Replace <your_laptop_ip> with the IP address you found in step 2.

  4. Access Files: You should now be able to access and browse the files in the directory where you started the HTTP server on your laptop. You can click on files to view or download them directly to your phone.

Remember that this connection is only accessible within your local network. If you want to access your laptop's server from outside your local network (e.g., over the internet), you would need to configure port forwarding on your router and possibly use dynamic DNS (DDNS) if you have a dynamic IP address.

Python

Python Essentials 1 (PCEP)

Introduction to Python and computer programming

Data types, variables, basic I/O operations, and basic operators

Boolean values, conditional execution, loops, lists and list processing, logical and bitwise operations

Clean Code

Algorithms

Django

Django Rest Framework

API

pip

SQLAlchemy

FastAPI

Pytest

TDD

Git

Linux

Docker

Python Testing

Interview Questions

Clone this wiki locally