
Product
Introducing Webhook Events for Alert Changes
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.
iframe-file-upload-middleware
Advanced tools
express framework already provides convenient way for uploading files using bodyParser. Ajax file uploading works great at modern browsers but we need a fallback for some "explorers" (yes, i'm watching at you msie) that doesn't support ajax file uploading. Fallback in this case - loading file using iframe. This lightweight (about 50 lines of code without dependencies) middleware provides iframe file uploading support for server side.
server setup, at your app.js
var app = express.createServer();
app.use(express.bodyParser());
var iframeFileUpload = require('iframe-file-upload-middleware');
iframeFileUpload.addRedirectResponder(app);
app.post(/^.*\/upload$/, iframeFileUpload.middleware());
now you can bind your handler at some upload url e.g. '/images/upload' and process uploads as you usually do, e.g.
app.post('/images/upload', function(req, res) {
res.json({filename: path.filename(req.files.image.path)});
});
client setup using jquery file upload
$('input[name=image]').fileupload({
url: '/images/upload',
redirect: 'default',
dataType: 'json'
}).on('fileuploaddone', function(event, data) {
alert(data.result.filename);
});
now you can upload image using file input and recives it's file name to the client. It will work in browsers (using ajax file upload) and in explorer using (iframe file uploading).
FAQs
Ajax file uploading iframe fallback for expressjs
The npm package iframe-file-upload-middleware receives a total of 1 weekly downloads. As such, iframe-file-upload-middleware popularity was classified as not popular.
We found that iframe-file-upload-middleware 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.

Product
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.

Security News
ENISA has become a CVE Program Root, giving the EU a central authority for coordinating vulnerability reporting, disclosure, and cross-border response.

Product
Socket now scans OpenVSX extensions, giving teams early detection of risky behaviors, hidden capabilities, and supply chain threats in developer tools.