file-upload
trigger file upload dialog using javascript/jquery
You mean something like this? http://jsfiddle.net/CSvjw/ $(‘input[type=text]’).click(function() { $(‘input[type=file]’).trigger(‘click’); }); $(‘input[type=file]’).change(function() { $(‘input[type=text]’).val($(this).val()); }); Note, though, that the value given by the file input is fake for security reasons. If you want to just have the file name show up, you can cut out the slashes. Here’s an example of how to do it using … Read more
copying the value of a form’s file input field to another form’s input field
You can’t move the value of one file input to another. Instead, clone the input, place the clone where the original is, and move the original into the hidden form. $(“.inputfield1”).change(function(){ var $this = $(this), $clone = $this.clone(); $this.after($clone).appendTo(hiddenform); });
How do I save a file to MongoDB?
If your files are small enough (under 16 megabytes), instead of adding the complexity of GridFS, you can just embed the files into BSON documents. BSON has a binary data type, to which any of the drivers should provide access. If your file is a text file you can just store it as a UTF8 … Read more
Why do browsers present selected files as coming from C:\fakepath\ instead of their true local path?
Some browsers have a security feature that prevents JavaScript from knowing your file’s local full path. It makes sense – as a client, you don’t want the server to know your local machine’s filesystem. It would be nice if all browsers did this.
Re-uploading a file with AJAX after it was changed causes net::ERR_UPLOAD_FILE_CHANGED in Chrome
A quick workaround would be to include a complete parameter to AJAX call (or any equivalent of a finally call that always gets invoked) and add code that resets the form. I’ve noticed that attaching the file again solves it. While I appreciate it’s not a real solution to the problem, it does provide handling … Read more
JavaScript Blob Upload with FormData
You have a typo in the function uploadCanvasData it should read formData.append(“file”, blob); Read your code more carefully!
Node.js: how to limit the HTTP request size and upload file size?
Just an update (07-2014), as I’m not able to add comments: As correctly noted above, newer Express versions have deprecated the use of the limit middleware and now provide it as a built-in option for the BodyParser middleware: var express = require(‘express’) var bodyParser = require(‘body-parser’) var app = express() app.use(bodyParser.json({ limit: ‘5mb’ }))