- One click file uploading
- Minimalistic interface
- Drag & Drop
- Sharex support
Visit yko.im for working example
- Clone the repository or download the zip
- Run
npm install
to install dependencies
- Create
local.toml
inconfig
- Override defaults in
local.toml
followingdefault.toml
format
default.toml
contains comments about the
- Run
yuiko.js
usingnode yuiko
or whatever process manager you like
Using the website is straight-forward, as the button says, you can either click on it or drag and drop files on the page.
Alternatively, you can upload manually by sending POST
request to /api/upload
endpoint.
The files should be included in field named files[]
, the Content-Type
should be set to multipart/form-data
.
The request may contain optional token
field with user identification token.
The api shall respond with JSON
with 3 possible elements:
success
-Boolean
, determines whether the request was successful or noterror
-String
, optional, if the request failed, contains error stringfiles
-Array
, array with uploaded files
The files
array containes elements of the following structure:
name
-String
, name on the serverextension
-String
, extension of the filesize
-Number
, file size (in bytes)url
-String
, the URL on which the file is accessible
Example response:
{
"success": true,
"files": [
{
"name": "ABC",
"extension": ".jpg",
"size": 42,
"url": "http://yuiko.xyz/files/ABC.jpg"
}
]
}
Files are served from config.files.uploadFolder
under config.files.accessPath
.
The base name of the file (the extension is omitted) is looked up in the database in order to get related file from the storage.
One file may be served under many names (aliases). Every user will get different name for the same file, all public uploads gets the same name.
For public uploads, Content-disposition
hear sets filename
to name
(as in url). For private uploads filename
is set to original name.
That's done to keep public upload more anonymous.
User accounts are yet to be implemented.
Default database engine is set to sqlite3
, although it's fairly easy to change it to any of the engines supported by Knex.
Visit it's page for documentation.
The application, like the most node web applications, is made to run behind reversed proxy.
You can utilize nginx
to create one, the configuration should be similar to:
upstream yuiko {
server 127.0.0.1:4242;
keepalive 128;
}
server {
listen 80;
server_name yuiko.xyz;
location / {
proxy_pass http://yuiko/;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-NginX-Proxy true;
}
}
Depending on you allowed uploaded file size, you may need to change client_max_body_size
in the http
block of the main nginx configuration file.
Example:
http {
...
client_max_body_size 100m;
...
}
For SSL support and more options consult Nginx documentation.
Please note that until the stable version is out, new releases may be not compatible with old ones. No migration tool is present at the moment.