在 CGI 上传中检查每个文件的长度而不是整个请求
我正在尝试修改 Uber-Uploader perl 脚本,以便在检查上传是否满足最低要求时,它会检查每个文件,而不仅仅是整个请求。
我对 perl 不太有经验,不知道该怎么做。目前,该脚本只是执行此操作:
elsif($ENV{'CONTENT_LENGTH'} > $config{'max_upload_size'}){
my $max_size = &format_bytes($config{'max_upload_size'}, 99);
die("Maximum upload size of $max_size exceeded");
}
所做的只是检查请求的内容长度(包含多个文件),并在总计大于允许的最大大小时失败。
有没有办法检查每个文件?
注意:更改上传脚本不是一个选项。不要尝试
I am attempting to modify the Uber-Uploader perl script so that when an upload is checked if it meets the minimum requirements, it checks per file instead of just the entire request.
I'm not too experienced with perl, and don't know how to do this. Currently the script simply does this:
elsif($ENV{'CONTENT_LENGTH'} > $config{'max_upload_size'}){
my $max_size = &format_bytes($config{'max_upload_size'}, 99);
die("Maximum upload size of $max_size exceeded");
}
All that does is check the content length of the request (which contains multiple files), and fail when the total is greater than the max allowed size.
Is there a way to check it per file?
Note: Changing upload scripts is not an option. Don't try
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不确定“更改上传脚本不是一个选项”是什么意思,但是您尝试过这样的事情吗?
(注意:这是未经测试的代码!!!!)
I'm not sure what you mean by "Changing upload scripts is not an option.", but have you tried something like this?
(NOTE: this is untested code!!!!!)