I'm implementing an API that must accept fairly large file uploads. The request will contain email and password parameters for authentication. Is it reasonable to force developer开发者_如何转开发s to place the email and password parameters /before/ the file data?
I'm using Formidable (a Node module) to parse the body and I figured that if I could pick out the email and password (and attempt to authenticate) before accepting the entire file, I could save memory and processor cycles by closing the connection before all the data streams in. Should I even worry about this?
I can certainly write the data to a temporary directory and either delete or move it based on the authentication attempt, but I'd like to find a better way, if one exists.
Thank you.
I'd say yes, it's OK to insist that someone proves who he/she is (and so forth) before accepting a large amount of data from him/her.
精彩评论