All Projects β†’ pomf β†’ Pomf

pomf / Pomf

Licence: mit
Simple file uploading and sharing

Projects that are alternatives of or similar to Pomf

kipp
A flexible file storage server
Stars: ✭ 33 (-93.83%)
Mutual labels:  files, upload, file-upload, file-sharing
Chibisafe
Blazing fast file uploader and awesome bunker written in node! πŸš€
Stars: ✭ 657 (+22.8%)
Mutual labels:  files, upload, file, file-upload
lolisafe
Blazing fast file uploader and awesome bunker written in node! πŸš€
Stars: ✭ 181 (-66.17%)
Mutual labels:  files, upload, file-upload, file-sharing
Uploadcare Widget
Uploadcare Widget, an ultimate tool for HTML5 file upload supporting multiple file upload, drag&drop, validation by file size/file extension/MIME file type, progress bar for file uploads, image preview.
Stars: ✭ 183 (-65.79%)
Mutual labels:  files, upload, file, file-upload
Express Fileupload
Simple express file upload middleware that wraps around busboy
Stars: ✭ 1,069 (+99.81%)
Mutual labels:  files, upload, file-upload
Aetherupload Laravel
A Laravel package to upload large files δΈŠδΌ ε€§ζ–‡δ»Άηš„Laravelζ‰©ε±•εŒ…
Stars: ✭ 835 (+56.07%)
Mutual labels:  files, upload, file
React Files
A file input (dropzone) management component for React
Stars: ✭ 126 (-76.45%)
Mutual labels:  files, upload, file
PHP-FileUpload
Simple and convenient file uploads β€” secure by default
Stars: ✭ 53 (-90.09%)
Mutual labels:  files, upload, file
Cj Upload
Higher order React components for file uploading (with progress) react file upload
Stars: ✭ 589 (+10.09%)
Mutual labels:  upload, file, file-upload
Telegram Upload
Upload and download files from Telegram up to 2GiB using your account
Stars: ✭ 223 (-58.32%)
Mutual labels:  files, upload, file-upload
cpomf
Pomf API compatible file host written in Crystal - The software behind nya.is.
Stars: ✭ 36 (-93.27%)
Mutual labels:  file-upload, hosting, file-sharing
Dropit
DropIt is a File Uploader built with nodejs, Upload, get a link, and share your files with anyone easily.
Stars: ✭ 367 (-31.4%)
Mutual labels:  file-sharing, file, file-upload
Uguu
Simple lightweight temporary file hosting.
Stars: ✭ 359 (-32.9%)
Mutual labels:  file-sharing, hosting, file-upload
Angular File Uploader
Angular file uploader is an Angular 2/4/5/6/7/8/9/10 + file uploader module with Real-Time Progress Bar, Responsive design, Angular Universal Compatibility, localization and multiple themes which includes Drag and Drop and much more.
Stars: ✭ 92 (-82.8%)
Mutual labels:  upload, file, file-upload
Fileup
FileUp - JQuery File Upload
Stars: ✭ 10 (-98.13%)
Mutual labels:  upload, file, file-upload
Linx Server
Self-hosted file/code/media sharing website. ~~~~~~~~~~~~~~~~~~~ Demo: https://demo.linx-server.net/
Stars: ✭ 1,044 (+95.14%)
Mutual labels:  file-sharing, upload, file-upload
Meteor-Files-Demos
Demos for ostrio:files package
Stars: ✭ 51 (-90.47%)
Mutual labels:  upload, file-upload, file-sharing
rustypaste
A minimal file upload/pastebin service.
Stars: ✭ 102 (-80.93%)
Mutual labels:  upload, file-upload, file-sharing
React Uploady
Modern file uploading - components & hooks for React
Stars: ✭ 372 (-30.47%)
Mutual labels:  files, upload, file-upload
SimpleFS
Simple, Portable PHP File-Sharing
Stars: ✭ 1 (-99.81%)
Mutual labels:  file-upload, file-sharing

Pomf

Build Status Quality Gate Status MIT licensed Documentation Status

Pomf is a simple file uploading and sharing platform.

Features

  • One click uploading, no registration required
  • A minimal, modern web interface
  • Drag & drop supported
  • Upload API with multiple response choices
    • JSON
    • HTML
    • Text
    • CSV
  • Supports ShareX and other screenshot tools

Demo

See the ((slightly modified)) real world example at safe.moe.

Requirements

Original development environment is Nginx + PHP5.5 + MySQL, but is confirmed to work with Apache 2.4 and newer PHP versions. Should work with any other PDO-compatible database.

Install

For the purposes of this guide, we won't cover setting up Nginx, PHP, MySQL, Node, or NPM. So we'll just assume you already have them all running well.

NPM/Node is only needed to compile the files, Pomf runs on PHP.

Compiling

First you must get a copy of the pomf code. To do so, clone this git repo. You will need to recursively clone the repo to get the required PHP submodule, and the optional user panel submodule.

git clone --recursive https://github.com/pomf/pomf

If you don't want either of the submodules run the following command,

git clone https://github.com/pomf/pomf

Assuming you already have Node and NPM working, compilation is easy. If you would like any additional submodules, or to exclude the default PHP submodule, use the MODULES="..." variable.

Run the following commands to do so.

cd pomf/
make
# alternatively
make MODULES="" # compile no submodules; exclude the default php backend module
make MODULES="php moe" # compile the php and moe submodules
#
make install

OR

make install DESTDIR=/desired/path/for/site

After this, the pomf site is now compressed and set up inside dist/, or, if specified, DESTDIR.

Configuring

Front-end related settings, such as the name of the site, and maximum allowable file size, are found in dist.json. Changes made here will only take effect after rebuilding the site pages. This may be done by running make from the root of the site directory.

Back-end related settings, such as database configuration, and path for uploaded files, are found in static/php/includes/settings.inc.php. Changes made here take effect immediately.

If you intend to allow uploading files larger than 2 MB, you may also need to increase POST size limits in php.ini and webserver configuration. For PHP, modify upload_max_filesize and post_max_size values. The configuration option for nginx webserver is client_max_body_size.

Example nginx configs can be found in confs/.

File expiration

If you want files to expire please have a look at Uguu instead which is based on Pomf.

Using SQLite as DB engine

We need to create the SQLite database before it may be used by pomf. Fortunately, this is incredibly simple.

First create a directory for the database, e.g. mkdir /var/db/pomf.
Then, create a new SQLite database from the schema, e.g. sqlite3 /var/db/pomf/pomf.sq3 -init /home/pomf/sqlite_schema.sql. Then, finally, ensure the permissions are correct, e.g.

chown nginx:nginx /var/db/pomf
chmod 0750 /var/db/pomf
chmod 0640 /var/db/pomf/pomf.sq3

Finally, edit php/includes/settings.inc.php to indicate this is the database engine you would like to use. Make the changes outlined below

define('POMF_DB_CONN', '[stuff]'); ---> define('POMF_DB_CONN', 'sqlite:/var/db/pomf/pomf.sq3');
define('POMF_DB_USER', '[stuff]'); ---> define('POMF_DB_USER', null);
define('POMF_DB_PASS', '[stuff]'); ---> define('POMF_DB_PASS', null);

NOTE: The directory where the SQLite database is stored, must be writable by the web server user

Nginx example config

I won't cover settings everything up, here are some Nginx examples. Use Letsencrypt to obain a SSL cert.

Main domain:

server{
    
    listen	        443 ssl http2;
    server_name		www.yourdomain.com yourdomain.com;

    ssl on;
    ssl_certificate /path/to/fullchain.pem;
    ssl_certificate_key /path/toprivkey.pem;
    ssl_protocols TLSv1.2 TLSv1.3;   

    root /path/to/pomf/dist/;
    autoindex		off;
    access_log      off;
    index index.html index.php;  

    location ~* \.(ico|css|js|ttf)$ {
    expires 7d;
    }

    location ~* \.php$ {
    fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
    fastcgi_intercept_errors on;
    fastcgi_index index.php;
    fastcgi_split_path_info ^(.+\.php)(.*)$;
    include fastcgi_params;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    }
}

Subdomain serving files (do not enable PHP here):

server{
    listen          443 ssl http2;
    server_name     www.subdomain.serveryourfiles.com subdomain.serveryourfiles.com;

    ssl on;
    ssl_certificate /path/to/fullchain.pem;
    ssl_certificate_key /path/to/privkey.pem;
    ssl_protocols TLSv1.2 TLSv1.3;
    
    root            /path/where/uploaded/files/are/stored/;
    autoindex       off;
    access_log	    off;
    index           index.html;
}

To redirect HTTP to HTTPS make a config for each domain like so:

server {
    listen 80;
    server_name www.domain.com domain.com; 
    return 301 https://domain.com$request_uri;
}

Migrating from MySQL to SQLite

, Compared to SQLite, MySQL is relatively complicated to administer, brings in many unneeded dependencies, and consumes more resources. Additonally, as a network service, poorly configured installations have the potential to pose a security risk.

For these reasons, you may wish to use SQLite rather than MySQL.

Fortunately, it is incredibly simple to migrate your database. This may be done on a live server, if you desire, and requires zero downtime.

The process described below involves running these commands on a live server. Nothing done here affects your main site, until running the very last command, which is done after verifying there are no issues.

No changes described here are destructive, and are easily reverted. They only have the potential to cause uploading to fail gracefully, and will not affect downloading.

Run the following commands as root, to dump your database, and make a SQLite database with the contents.

mkdir /var/db/pomf
wget -O /tmp/m2s https://github.com/dumblob/mysql2sqlite/raw/master/mysql2sqlite.sh
mysqldump -u OLD_DB_USER -p OLD_DB_PASS pomf | sh /tmp/m2s | sqlite3 /var/db/pomf/sq3
rm /tmp/m2s
chown -R nginx:nginx /var/db/pomf #replace user as appropriate
chmod 0750 /var/db/pomf && chmod 0640 /var/db/pomf/sq3

Edit the file php/includes/settings.inc.php, in your source directory, making the changes outlined below. Note, changing the second two lines is optional, as they are simply ignored when using SQLite.

define('POMF_DB_CONN', '[stuff]'); ---> define('POMF_DB_CONN', 'sqlite:/var/db/pomf/pomf.sq3');
define('POMF_DB_USER', '[stuff]'); ---> define('POMF_DB_USER', null);
define('POMF_DB_PASS', '[stuff]'); ---> define('POMF_DB_PASS', null);

Then, run make DESTDIR=/path/to/main_site/testing_dir (note the testing_dir component) to rebuild the website, and copy it into place, in a new testing subdirectory.

Now, navigate to this subdirectory in your web browser, e.g. http://example.com/testing_dir, and verify that uploading works fine. If so, excellent! You may rerun make DESTDIR=/path/to/main_site to update your main site.

All done! You may disable or uninstall MySQL if you wish.

API

To upload using curl or make a tool you can post using:

curl -i -F files[][email protected] https://pomf.se/upload.php (JSON Response)
curl -i -F files[][email protected] https://pomf.se/upload.php?output=text (Text Response)
curl -i -F files[][email protected] https://pomf.se/upload.php?output=csv (CSV Response)
curl -i -F files[][email protected] https://pomf.se/upload.php?output=html (HTML Response)

Getting help

The Pomf community gathers on IRC. You can also email the maintainer for help.

  • IRC (users): #pomfret on Rizon (irc.rizon.net)

Contributing

We'd really like if you can take some time to make sure your coding style is consistent with the project. Pomf follows PHP PSR-2 and Airbnb JavaScript (ES5) (airbnb/legacy) coding style guides. We use ESLint and PHPCS tools to enforce these standards.

You can also help by sending us feature requests or writing documentation and tests.

Thanks!

Credits

Pomf was created by Eric Johansson and Peter Lejeck for Pomf.se. The software is currently maintained by the community.

License

Pomf is free software, and is released under the terms of the Expat license. See LICENSE.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].