Catalyst 请求上传 - 截断文件
我正在使用 Catalyst Request Upload 来通过前端的 Jumploader 小程序上传文件。对于 10k 左右的文件来说一切都很好。但如果文件较大,我只能得到最后上传的“块”。使用 Data::Dumper
我可以看到“10k 位”被上传,并且每个部分都被放入随机临时目录中。我的问题是如何上传整个文件而不将其分解?
if ( my $upload = $c->request->upload('file') ) {
my $filename = $upload->filename;
$target = "$file_path/$campaign/$filename";
unless ( $upload->link_to($target) || $upload->copy_to($target) ) {
die( "Failed to copy '$filename' to '$target': $!" );
}
}
感谢您的帮助。
I am using Catalyst Request Upload to upload files with the Jumploader applet on the front end. Everything is fine for files under 10k or so. But if files are larger, I only get the last uploaded "chunk". Using Data::Dumper
I can see the "10k bits" getting uploaded and each piece is put in a random temp dir. My question is how to upload the whole file and not have it broken up?
if ( my $upload = $c->request->upload('file') ) {
my $filename = $upload->filename;
$target = "$file_path/$campaign/$filename";
unless ( $upload->link_to($target) || $upload->copy_to($target) ) {
die( "Failed to copy '$filename' to '$target': $!" );
}
}
Thank you for your help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
默认情况下,catalyst 中的上传(由 Catalyst::Request::Upload 完成)读取从 HTTP 发送的内容并将其保存到 tmp 文件中。
也许 Jumploader 正在通过多个 HTTP 请求发送更大的文件。所以你需要调试看看发生了什么。
您可以使用“-d”启动服务器或导出
CATALYST_DEBUG=1
env。然后发送一个大文件并查看对催化剂执行的请求数量。如果不止一个,Jumploader 可能会随请求发送一些内容,例如“上传文件 ID”,以便您可以将所有部分粘合在一起。
By default, uploads in catalyst (done by Catalyst::Request::Upload) reads the content sent from HTTP and them save to a tmp file.
Maybe Jumploader is sending bigger files with more than one HTTP request. So you need to debug to see what is happening.
You can start a server with "-d" or export
CATALYST_DEBUG=1
env. Then send one big file and see the number of requests that are done to the catalyst.If it's is more than one, Jumploader may send something with the request, like an "upload file id" to make possible to you glue together all the pieces.