Comments (9)
I would like to +1 this request. It should not rely only on the client filter. The server needs to reject files larger than the specified amount, and make sure the final size is the same as announced at the start. Filtering by extension is good too.
Currently the behavior for submitting a 20mb+ file is an empty file being created, and the server hanging indefinitely thereafter. The only way this is viable in a production environment is if you can force a maximum size with 100% certainty.
I would lend my hand, but I fear I may not be up to the task.
from socketio-file-upload.
Yeah, you're right. This feature should really be supported in this module. I'll look into it.
from socketio-file-upload.
My latest commit adds support for file size checking. Let me know if the API and such looks good to you. If it does then I'll go ahead and push it out to npm.
from socketio-file-upload.
Well it's not impenetrable, but the "saved" event is now rather inaccurately named. I would suggest adding an error code for straight up upload failure as well, and dropping the success flag. "Saved" should be reserved for success cases only, or renamed appropriately. Handling file rejection out of the "error" event seems fine to me.
from socketio-file-upload.
Well it's not impenetrable
Can you explain?
but the "saved" event is now rather inaccurately named. I would suggest adding an error code for straight up upload failure as well, and dropping the success flag. "Saved" should be reserved for success cases only, or renamed appropriately. Handling file rejection out of the "error" event seems fine to me.
The "error" event is fired when file upload is large. An empty file is always created on the filesystem, so it seems to me like "saved" is a fine event name. An application can always check for event.file.success
for whether or not the save was successful. Renaming the event is not an option due to backwards compatibility, which I put as a high priority.
from socketio-file-upload.
By not impenetrable, I simply meant that it's not difficult to understand. :)
Are you sure you want an empty file to be created if the server intends to reject the upload? I think the logical behavior is that you want to stop the process as soon as you know that you don't want the file, so as not to even bother the file system with useless tasks.
EDIT: Oh, I understand. In an ideal world, you would be writing to the file one part at a time, not buffering it. Your api makes sense now.
from socketio-file-upload.
The client could tell the server ahead of time how big to make the file, and if the file exceeds the bounds then the server can ignore it. However, this depends on the client telling the truth about the size of the file, and if the client is telling the truth, then they won't even send a request to the server in the first place due to the client-side validation in 5ff8e73.
I'll run a few more manual tests and then push this out to npm. One of these days I'll need to set up automated testing for this module (or merge a pull request that does it). 😃
from socketio-file-upload.
thank you for implementing the requirement :)
from socketio-file-upload.
This change has been published to npm in versions 0.3.1 and higher.
from socketio-file-upload.
Related Issues (20)
- Possible memory issue HOT 2
- does it work with socket io 2.0? HOT 1
- how to move file to different folder after receiving. HOT 1
- When maxFileSize is set, emitChunkFail is force to true
- Investigate why tests require Socket.io 2.1.1
- Starting but not uploading HOT 4
- Resume upload on reconnect
- unbind listeners of server instance HOT 1
- Error when file size is greater than maxFileSize
- Rewrite in TypeScript HOT 4
- How's make a client-server-client application ? HOT 1
- Socket disconnects may cancel in-progress uploads for other clients HOT 4
- How to upload a file in base64 format? HOT 3
- How to use node js as client side. HOT 1
- Problem with nginx HOT 4
- 同学,您这个项目引入了372个开源组件,存在8个漏洞,辛苦升级一下 HOT 1
- Upload speed seems slow HOT 1
- No events from the client and the server.
- Is this supposed to work with Socket.IO version 4+? HOT 4
- How to upload files using java client?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from socketio-file-upload.