All Projects β†’ Rouji β†’ Single_php_filehost

Rouji / Single_php_filehost

Licence: isc
Simple Filehosting Page in a Single PHP File (obvious 0x0 clone)

Projects that are alternatives of or similar to Single php filehost

Youtransfer
The simple but elegant self-hosted file transfer & sharing solution
Stars: ✭ 1,525 (+1261.61%)
Mutual labels:  file-sharing, simple
Postmate
πŸ“­ A powerful, simple, promise-based postMessage library.
Stars: ✭ 1,638 (+1362.5%)
Mutual labels:  simple
Communityserver
Free open source office suite with business productivity tools: document and project management, CRM, mail aggregator.
Stars: ✭ 1,363 (+1116.96%)
Mutual labels:  file-sharing
Pg Calendar
πŸ“† beautiful and eidetic date picker
Stars: ✭ 109 (-2.68%)
Mutual labels:  simple
Minidyndns
A simple DynDNS server with an build in HTTP interface to update IPs
Stars: ✭ 101 (-9.82%)
Mutual labels:  simple
Typeis
Typeis. it's the smart and simple javaScript type checker
Stars: ✭ 100 (-10.71%)
Mutual labels:  simple
Rsget
A simple command line utility to download a remote file, similar to wget. This is not intended to be a full feature wget replacement but a simple tool to test few Rust crates.
Stars: ✭ 98 (-12.5%)
Mutual labels:  simple
Simple
The Simple Intelligent and Modular Programming Language and Environment
Stars: ✭ 120 (+7.14%)
Mutual labels:  simple
Long Live Pomf
Pomf.se alternatives
Stars: ✭ 115 (+2.68%)
Mutual labels:  file-sharing
Airdcpp Webclient
Communal peer-to-peer file sharing application for file servers/NAS devices
Stars: ✭ 106 (-5.36%)
Mutual labels:  file-sharing
Openssh Portable
Portable OpenSSH
Stars: ✭ 1,696 (+1414.29%)
Mutual labels:  file-sharing
Borm
【πŸ”₯今ζ—₯ηƒ­ι—¨γ€‘πŸŽοΈ ζ›΄ε₯½ηš„ORMεΊ“ (Better ORM library that is simple, fast and self-mockable for Go)
Stars: ✭ 102 (-8.93%)
Mutual labels:  simple
Simple Neural Networks
Simple neural networks based only on Numpy
Stars: ✭ 114 (+1.79%)
Mutual labels:  simple
Filegogo
A file transfer tool that can be used in the browser webrtc p2p
Stars: ✭ 117 (+4.46%)
Mutual labels:  file-sharing
Easyiterator
πŸƒ Iterators made easy! Zero cost abstractions for designing and using C++ iterators.
Stars: ✭ 107 (-4.46%)
Mutual labels:  simple
Parsec Cloud
Open source Dropbox-like file sharing with full client encryption !
Stars: ✭ 99 (-11.61%)
Mutual labels:  file-sharing
Munin
Main repository for munin master / node / plugins
Stars: ✭ 1,593 (+1322.32%)
Mutual labels:  simple
Template
A super-simple way to create new projects based on templates.
Stars: ✭ 120 (+7.14%)
Mutual labels:  simple
Webdrop
Easiest group P2P File & Message transfer in browser with WebRTC πŸ”₯. Cross-platform alternative to Apple's AirDrop, Xender, ShareIT with the same speed over LAN. No installation, just a website :)
Stars: ✭ 119 (+6.25%)
Mutual labels:  file-sharing
Orion
[Moved to Gitlab] Easy to Use, Inter Planetary File System (IPFS) desktop client
Stars: ✭ 115 (+2.68%)
Mutual labels:  file-sharing

Single .php Filehost

Simple PHP script, mainly for sharing random files with people using curl. (and thus in an easily scriptable way)

Puts a file sent via POST into a configured directory with a randomised filename but preserving the original file extension and returns a link to it.
Actually serving the file to people is left to apache to figure out.

There's also a mechanism for removing files over a certain age, which can be invoked by calling the script with a commandline argument.

Config

All configuration is done using the global variables at the top of index.php. Hopefully they're explained well enough in the short comments besides them.

To accommodate for larger uploads, you'll also need to set the following values in your php.ini:
upload_max_filesize
post_max_size
max_input_time
max_execution_time
(The output of index.php will also warn you, if any of those are set too small)

The code responsible for the default info text can be found at the very bottom of index.php, in case you want to reword anything.

Apache

Pretty straight forward, I use something like this:

<Directory /path/to/webroot/>
    Options +FollowSymLinks -MultiViews -Indexes
    AddDefaultCharset UTF-8
    AllowOverride None

    RewriteEngine On
    RewriteCond "%{ENV:REDIRECT_STATUS}" "^$"
    RewriteRule "^/?$" "index.php" [L,END]
    RewriteRule "^(.+)$" "files/$1" [L,END]
</Directory>

<Directory /path/to/webroot/files>
    Options -ExecCGI
    php_flag engine off
    SetHandler None
    AddType text/plain .php .php5 .html .htm .cpp .c .h .sh
</Directory>

Purging Old Files

To check for any files that exceed their max age and delete them, you need to call index.php with the argument "purge"

php index.php purge

To automate this, simply create a cron job:

0 0 * * * cd /path/to/the/root; php index.php purge > /dev/null

If you specify $STORE_PATH using an absolute path, you can omit the cd

Max. File Age

The max age of a file is computed using the following formula:

$file_max_age = $MIN_FILEAGE +  
                ($MAX_FILEAGE - $MIN_FILEAGE) *  
                pow(1-($fileSize/$MAX_FILESIZE),$DECAY_EXP);

...which is a basic exponential decay curve that favours smaller files, meaning small files are kept longer and really big ones are deleted relatively quickly.
$DECAY_EXP is one of the configurable globals and basically makes the curve more or less exponential-looking. Set to 1 for a completely linear relationship.

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].