A lightweight and easy-deployed file system server based on php and XAMPP server for multiplatform file upload/downloading
To access the latest updates, browse the branches
When training AI models on Linux (Ubuntu) servers, it is often found hard to transmit the fine-tuned model back to other PCs which usually do not install with the ssh server (or other file server) for inference. Thus I decided to develop a file system that can enable cross-platform file uploading and downloading. Most importantly, easy-to-deploy and free.
v0_3 features: login/signup, upload/download enabled for both Ubuntu and Windows. However, everyone can download your uploaded files without login. Thus do not upload your sensitive files! The login is for authorizing uploading.
Install XAMPP to /opt/lampp
from https://www.apachefriends.org/download.html (my PHP Version 8.2.12).
Optional: Modify your server configurations (e.g.: HTTP service port, SQL port, development settings, SSL settings for HTTPS, file transmission limitations) in /opt/lampp/etc
.
- http port communication: default is 80, to modify it:
etc/httpd.conf
. - https port and ssl modify: default port is 443, default ssl certification location:
etc/ssl.crt/server.crt
, default ssl private key location:etc/ssl.key/server.key
, to modify it:etc/extra/httpd-ssl.conf
. I use Aliyun's SSL which has an intermediate certificate. Thus it is required to concatenate the ssl certification (primary) with this intermediate certification to get a full-chain certification:cat ssl.crt chain.crt > server.key
. - Maximum POST file size (transmission limitation):
post_max_size
, variables afterfile_uploads
inetc/php.ini
.
Start XAMPP (lampp) by executing ./lampp start
under /opt/lampp
directory (the following tutorial is also in this folder).
Initialize SQL:
./bin/mysql -u root -p
(default password is empty, and here we use the root account to log in)- create a database (
CREATE database_name;
) or use an existing one (in this case,test
) USE test
- create tables:
create test_login table for storing account information:CREATE TABLE test_login (username VARCHAR(8) PRIMARY KEY UNIQUE NOT NULL, password VARCHAR(16) NOT NULL, date_created TIMESTAMP DEFAULT NOW() NOT NULL);
create test_user_data for storing files' information:CREATE TABLE test_user_data (username VARCHAR(8) NOT NULL, file_name VARCHAR(255) NOT NULL, file_path VARCHAR(255) NOT NULL, upload_time TIMESTAMP DEFAULT NOW() NOT NULL, PRIMARY KEY(username, file_name), FOREIGN KEY (username) REFERENCES test_login(username) ON DELETE CASCADE ON UPDATE RESTRICT);
- copy this repository content end with
*.php
under./htdocs
folder asSpXFSS
, and create a folder calleddisk
under./htdocs/SpXFSS/
(user uploadings will be stored here), change the privilege ofdisk
as 0777.
- For your own server, remember to modify
*URL
value in*.sh
files to your URL. - make
*.sh
executable bychmod +x *.sh
in your client folder. ./login.sh your_username your_password
there should be acookies.txt
file saved../upload.sh your_file_path
the upload should be finished moments later. (one file upload at one time)
- Delete a user account: Close the XAMPP server first, then use the
test
database as mentioned above,DELETE FROM test_login WHERE username='xxx';
, delete the user's folder underdisk
.
Caveat: This project is still in beta version, thus the security might be vulnerable. Welcome to pull contribution!