开发者

Authenticating large file uploads

开发者 https://www.devze.com 2023-03-09 14:32 出处:网络
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

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消