-
Notifications
You must be signed in to change notification settings - Fork 88
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
Decrypting a file to output buffer fails #182
Comments
I could fix this issue by wrapping the handle into a new (Solution to my problem here). $decipheredName = Crypto::decrypt($file->name, $enc_key)->getString();
$filepath = storage_path().'/app/'.$file->name;
$stream = new MutableFile(fopen('php://output', 'wb'));
ob_start();
File::decrypt($filepath, $stream, $enc_key);
return response()->streamDownload(function() {
echo ob_get_clean();
} ,$decipheredName); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, I'm creating an application where files are encrypted when they're received and decrypted only when an authenticated user clicks on the file link in their own dashboard. As such, I'm trying to write to the output buffer so it's downloaded on their end but never appears decrypted on the server's storage.
To do this I do something like the following in a function body, that function is called with a POST request that fetches the
$file
name and id in storage. I got the writing to output lines from this pull request.But when I use is, I get a type error:
How can I fix this?
Sorry if this seems trivial, I'm not used to web dev at all.
This is all running inside a VM using Homestead (
"laravel/homestead": "^13.2"
) with the most recent version of Halite as well.The text was updated successfully, but these errors were encountered: