Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
dpd-fileupload
Advanced tools
Check out this repo for a demo of this module.
This module provides functionality to upload files within Deployd. The uploaded files will be stored in the public folder of Deployd and the filenames will be stored in a collection.
Don't hesitate to fill an issue if you find a bug or need a feature.
Go to the base directory of your Deployd project and enter:
$ npm install deployd
$ npm install dpd-fileupload --save
Once installed, you can add a resource of type fileupload in the dashboard.
$ git clone git@github.com:NicolasRitouet/dpd-fileupload.git
$ cd dpd-fileupload
$ npm install deployd
$ npm link
By default, the module will create a folder called "upload" inside the public directory. You can then access your files by calling: http://localhost:2403/upload/filename.extension
If you need to, you can change the name of the directory in the dashboard under CONFIG.
Method POST or PUT (set content type to "multipart/form-data"), send "subdir" as request param to save the file in a sub directory. Any request parameter sent will be stored in the resource object.
Working demo available here: https://github.com/NicolasRitouet/dpd-fileupload-demo
Response of a successful upload:
[{
filename: 'screenshot.png',
subdir: "images",
creationDate: 1389946339569,
id: '2f4c752310e2bbae',
filesize: '75148412',
optionalParam:'foobar'
}, {
filename: 'screenshot (1).png',
subdir: "images",
creationDate: 1389946339233,
id: 'ef43f52310e2bbae',
filesize: '85412',
optionalParam:'foobar'
}, ...]
Method GET
dpd.fileupload.get(function(result, err) {
console.log(result);
});
The response:
[{
filename: 'screenshot.png',
subdir: "images",
creationDate: 1389946339569,
id: '2f4c752310e2bbae',
filesize: '75148412',
optionalParam:'foobar'
}, {
filename: 'screenshot (1).png',
subdir: "images",
creationDate: 1389946339233,
id: 'ef43f52310e2bbae',
filesize: '8441547',
optionalParam:'foobar'
}, ...]
Since we upload the files into the /public folder, you can access your files like this: http://localhost:2403/upload/subdir/filename.extension replace:
If you would like more security and some rights management to get the files, fill an issue about this and I might work on this feature.
Method DELETE
dpd.fileupload.del(id, function(result, err) {
if (err) alert(err);
console.log(result);
});
This module provides three custom events in the dashboard: get
, upload
, delete
They contains the following variables:
ctx
: more documentation on [docs.deployd.com](http://docs.deployd.com/docs/collections/reference/event-api.html#s-ctx -764)upload
event also contains the following objects:
url
filename
originalFilename
filesize
uniqueFilename
subdir
Example on dpd-fileupload-demo
Thanks to @Mortgy, we now have authentication within dpd-fileupload
.
There's a new checkbox in the dashboard to configure the authorization. If you need your users to be logged-in to view, upload or delete the files, this checkbox is yours!
If your users are logged-in with deployd
, they'll have access to the resources.
E11000 error
PR #36 (Thanks @hjanuschka). The rest of the fix is on Deployd side (#653)FAQs
File uploader for Deployd
The npm package dpd-fileupload receives a total of 14 weekly downloads. As such, dpd-fileupload popularity was classified as not popular.
We found that dpd-fileupload demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.