Answer the question
In order to leave comments, you need to log in
How to upload a large file to the server using a link?
Greetings!
Please tell me, is there any simple way in laravel to copy a large file to the server from an external resource by url?
I found this package - https://github.com/Naxon/laravel-url-uploaded-file
But for some reason files larger than ~2.5gb are not uploaded
in php.ini
upload_max_filesize=4000M
post_max_size=4000M
max_execution_time=3600
Answer the question
In order to leave comments, you need to log in
The first is to check the file system, the second is to check your php assembly, in older versions of php there was such a phenomenon on 32-bit assemblies, well, I would show your import code itself.
If I find it, I will throw my import here
$dir = 'uploads';
$newFile = basename(rtrim($url, '/'));
$uploadFile = new SplFileObject($url, 'rb');
$file = new SplFileObject($dir . DIRECTORY_SEPARATOR . $newFile, 'w');
$file->setFlags(SplFileObject::SKIP_EMPTY);
if ($file->flock(LOCK_EX)) {
$file->ftruncate(0);
while (!$uploadFile->eof()) {
$file->fwrite($uploadFile->fgets());
}
}
$file->flock(LOCK_UN);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question