jus - Just Upload Stuff
Users can just upload one or multiple files, get a direct link to them and share it.
Admins can just put the source wherever they want, configure the two or three options, and clean up the old files any way they like.
Source and configuration should ideally live outside your document root, but if you don't know what this means just put everything in your web directory.
You can then rename the
www directory to whatever you like, as well as the
index.php file provided
they stay at the same place relative to
cfg/config.inc.php and tweak it (more on this later).
If you want to be able to use PUT queries to upload files with
curl, you will have to set
the PUT handler script for Apache (it can work with Nginx as well, but you will have to research it yourself).
This means enabling
mod_actions and adding
Script PUT /put.php in your virtual host section.
If you're going to host this on Free.fr's free hosting, you should first put the following in a file
.htaccess in your web directory:
<IfDefine Free> php56 1 </IfDefine>
Then you should probably change the configuration defaults:
upload_directory is where the uploaded files with be saved. Use
__DIR__ to be sure to have a
path relative to this config file. Ideally, this should be outside of the document root for jus.
upload_server is the prefix that will be given to uploaded files. If you have a different virtual host
for serving uploaded files, which I recommend in order to make sure nobody messes up with your jus
then this option should have the name of this file serving virtual host. In my case, jus lives at
down.ÿ.fr, configured to have
upload_directory as its document root.
max_size is the maximum size to accept for files. Don't forget to adjust your
php.ini settings as well,
relevant options are
There are three different ways for a user to upload a file on jus.
The most obvious is clicking the Select your file button, selecting one or more files, and clicking Up. Once the upload is finished, the links to the files are shown.
PUT is correctly configured on your server, another way is to type this from command-line:
curl -T <file> https://url-to-jus
If it is not, curl can still upload easily enough using
curl -F "file"=@<file> https://url-to-jus
curl, the output will just contain the paths to the upload files, one by line.
jus will put files in
upload_directory under subdirectories, one for each day. So something uploaded
on the 18th of August in 2017 would be in
files/2017-08-18. If you want to limit the duration the files
are available on your server, it should be easy enough to have a cron that every day removes the folder of
today minus 30 days, or minus 365 or 12 000 days.
rm -rf "/path/to/jus/files/$(date --date='30 days ago' +'%Y-%m-%d')"
in your cron.