Files sharing application made in PHP
Files Sharing
FILES SHARING VERSION 2 JUST RELEASED
Description
This PHP application based on Laravel 10.9 allows to share files like Wetransfer. You may install it on your own server. It does not require any database system, it works with JSON files into the storage folder. It is multilingual and comes with english, french and korean translations for now. You're welcome to help translating the app.
This application provides two links per bundle :
Each of these links comes with an authorization code. This code is the same for the preview and the download links.
The application also comes with a Laravel Artisan command as a background task who will physically remove expired bundle files of the storage disk. This command is configured to run every five minutes among the Laravel scheduled commands.
Features
Demo Online Demo
You may visit my Online Demo
Video Demo
A video demo is available on Youtube
Screenshot
Requirements
Basically, nothing more than Laravel itself:
Plus:
The application also uses:
Installation Docker
You may now install FileSharing via Docker. See https://hub.docker.com/r/axeloz/filesharing
docker run -d \
-p 8080:80 \
-v <local_path>:/app/storage/content \
--name filesharing \
-e APP_NAME="FileSharing" \
-e APP_URL="<your_url>" \
-e ASSET_URL="<your_asset_url>" \
-e UPLOAD_MAX_FILESIZE="1G" \
-e APP_TIMEZONE="Europe/Paris" \
-e UPLOAD_PREVENT_DUPLICATES=true \
-e HASH_MAX_FILESIZE="1G" \
-e UPLOAD_MAX_FILES=100 \
-e LIMIT_DOWNLOAD_RATE="100K" \
axeloz/filesharing:latest
-v
option to bind your local storage to the docker instance (persisting data)-p
option to listen to the port you need-e
optionSimple config for Nginx:
server {
server_name filesharing.box.webinno.fr;
charset utf-8;
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_pass http://localhost:8080;
}
listen [::]:443 ssl http2;
listen 443 ssl http2;
ssl_certificate [...]
ssl_certificate_key [...]
}
You can also use in docker compose with the following template:
version: '3' services: app: image: axeloz/filesharing:latest environment: UPLOAD_MAX_FILESIZE: "1G" UPLOAD_MAX_FILES: "100" UPLOAD_LIMIT_IPS: "127.0.0.1" UPLOAD_PREVENT_DUPLICATES: true HASH_MAX_FILESIZE: "1G" LIMIT_DOWNLOAD_RATE: "1M" volumes: - files_v:/app/storage/content ports: - 8080:80Standalonevolumes: files_v: driver: local
./public
foldercomposer install
yarn --production
(or npm install --production
)yarn build
(or npm run build
)./storage
folderphp artisan key:generate
cp .env.example .env
and edit .env
to fit your needsphp artisan fs:user:create
* * * * * /usr/bin/php /path-to-your-project/artisan schedule:run >> /dev/null 2>&1
php artisan fs:bundle:purge
Use your browser to navigate to your domain name (example: files.yourdomain.com) and that's it.
Configuration
In order to configure your application, copy the .env.example file into .env. Then edit the .env file.
Configuration Description
APP_NAME
the title of the application
APP_ENV
change this to production
when in production (local
otherwise)
APP_DEBUG
change this to false
when in production (true
otherwise)
APP_TIMEZONE
change this to your current timezone
APP_LOCALE
change this to "fr", "en" or "kr"
UPLOAD_PREVENT_DUPLICATES
Should the app block duplicate files (true / false)
HASH_MAX_FILESIZE
max size for hashing file to check for duplicate files. If files are bigger than limit, they will not be hashed. Find the best value for better cpu / memory consumption
UPLOAD_MAX_FILES
(optional) maximal number of files per bundle
UPLOAD_MAX_FILESIZE
(optional) change this to the value you want (K, M, G, T, ...). Attention : you must configure your PHP settings too (post_max_size
, upload_max_filesize
and memory_limit
). When missing, using PHP lowest configuration
UPLOAD_LIMIT_IPS
(optional) a comma separated list of IPs from which you may upload files. Different formats are supported : Full IP address (192.168.10.2), Wildcard format (192.168.10.*), CIDR Format (192.168.10/24 or 1.2.3.4/255.255.255.0) or Start-end IP (192.168.10.0-192.168.10.10). When missing, filtering is disabled.
LIMIT_DOWNLOAD_RATE
(optional) if set, limit the download rate. For instance, you may set LIMIT_DOWNLOAD_RATE=100K
to limit download rate to 100Ko/s
Authentication
You may provide a list of IPs to limit access to the upload feature.
Or you can create users with login/password credentials.
You can also mix the two methods.
Warning: if your leave the
UPLOAD_LIMIT_IPS
empty and you don't create users, the upload will be publicly accessible
Known issues
If you are using Nginx, you might be required to do additional setup in order to increase the upload max size. Check the Nginx's documentation for client_max_body_size
.
Development
If your want to modify the sources, you can use the Laravel Mix features:
composer install
yarn install
yarn dev
in order to recompile the assets when changedRoadmap / Ideas / Improvements
There are many ideas to come. You are welcome to participate.
Licence
GPLv3
Permissions Conditions Limitations
Commercial use Disclose source Liability
Distribution License and copyright notice Warranty
Modification Same license
Patent use State changes
Private use
https://choosealicense.com/licenses/gpl-3.0/
Welcome on board
If you are willing to participate or if you just want to talk with me : axel@mabox.eu
Powered by
Twice a month we will interview people behind open source businesses. We will talk about how they are building a business on top of open source projects.
We'll never share your email with anyone else.