F
F
FullTwo2022-04-17 07:11:45
PHP
FullTwo, 2022-04-17 07:11:45

I change the name of the apk file on the fly, but when downloading, it shows that the archive is broken how?

I change the name of the file on the fly when downloading, the size corresponds to the original, but this archive, when installed on the phone, says that "Failed to process the package" with the original there are no problems!
apk format
file The file is located on another server

Code

$file = get_headers($url);
foreach($file as $a){
header($a);
}
header('Content-Disposition: attachment;filename="'.$files->file.'"');
readfile($url);


$url - link to the file
$files->file - output from the database of the name

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
TheAndrey7, 2022-04-17
@TheAndrey7

Because the readfile() function is designed to return the file that you have on disk. And you are trying to give something by URL there. In such cases, it is useful to occasionally open the downloaded file with notepad to make sure its contents are correct.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question