New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make Mojo::Asset::File writable to the existed files. #649
Conversation
…n the file becomes read-only mode.
What's the use case for this change? |
Actually, when uploading a huge file(eg. 2GB), I hope Mojo::Asset::File to be able to upload the file in multiply HTTP requests. In this way, people won't have to wait the uploading process for hours, instead, they can resume the upload process at any time they want. I found the "add_chunk" in Mojo::Asset::File is able to do it. Unfortunately, "add_chunk" can only add "chunk" to the file it's uploading. It's not able to add chunk to an existed file, which is required for my use case. So my proposal is to only change one bit of Mojo::Asset::File module at line 20. It will help a lot for my scenario and it doesn't affect any existed features. |
Could you elaborate a bit? I've brought up the topic on IRC and we were having trouble understanding the use case. |
@@ -209,6 +209,18 @@ ok !$asset->is_file, 'stored in memory'; | |||
ok !-e $path, 'file has been cleaned up'; | |||
} | |||
|
|||
# Custom existing file | |||
my ($fh, $tmppath) = tempfile(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$fh
is initialized but not used.
I was in China, can not connect to the IRC server. |
I am here to develop a HTML5 file upload to a binary file into a way to upload the data block . |
Much like the following, each connection, open a file, and then write additional blocks.
};
}; |
We're sorry, the second paragraph of the code is wrong. |
Thanks, applied with a few small changes. |
Thank you very much for supporting me, my html5 large files "breakpoint resume" developed using the latest Mojolicous finished. My project addresses: https://github.com/iakuf/mojolicious-stream-upload |
I'm afraid this is going to be reverted in Mojolicious 5.52, because there have been too many problems with read-only file systems. Lots of test failures from CPAN Testers and user complaints. 04aa323 |
Is there any support for using |
After debugging for days, I figured it out finally and fixed my code.
This patch is to make the Mojo::Asset::File more flexible, it gives the write permission to the module when handling uploading/downloading files.