
Security News
Meet Socket at Black Hat and DEF CON 2025 in Las Vegas
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
file-upload-component
Advanced tools
Web component based file picker for web, with customizable upload backend.
A work in progress HTML file upload with customizable upload backend.
var UploadControllerFactory = require('uploadcontroller');
var UploadController = UploadControllerFactory({
// specify a built in upload method,
upload: UploadControllerFactory.XHR({
xhrUrl: 'http://localhost/upload.php?filename=$file', // you can use $file to put file name to the URL
xhrAsFormData: true, // if true, it sends the file as multipart data. Otherwise the whole file is sent as a body with correct mime type
xhrFormDataFileKey: 'file', // if xhrAsFormData true,
xhrMethod: 'POST', // default
xhrHeaders: {}, // extra headers to be sent
xhrCallback: function(xhr) { }, // XHR hook before sending data
})
// or a customized one
upload: function(name, blob, contentType, abort, progress) {
// Disables XHR and enables custom uploading backend.
// Function must return a promise that will resolve with a javascript object.
// when the user aborts the uploading, the AbortSignal is fired.
// upload progress can be reported back to library by calling progress function which accepts numbers from 0 to 1 (i.e. progress(50 / 100) means half of the upload is completed).
},
valueKey: 'id',
srcKey: 'access_url',
fields: ['id', 'access_url', 'name', 'size'] // save additional data from response, so they can be accessed from JavaScript with UploadController inside
});
<file-picker name="file" desc="Upload File"></file-picker>
<file-picker name="file" filename="2.jpg" size="88316" src="https://www.gstatic.com/webp/gallery/2.jpg" value="11" desc="Upload File"></file-picker>
"valueKey" returned from the upload backend will be submitted in the form with "name" attribute on the element.
FAQs
Web component based file picker for web, with customizable upload backend.
We found that file-upload-component 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
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
Security News
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
Security News
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.