-4
I have xml files stored in a blob field of a mysql table, I would like to know how to download these files on the local user disk automatically using php.
Create a low function on the server and not on the local disk.
function baixarArquivos($res) {
while ($arq = mysqli_fetch_array($res)) {
$nomearquivo = $arq['CHAVEXML'];
$arquivoxml = $arq['XML'];
$path = 'c:\Temp\\xml\\'.$nomearquivo.'xml';
file_put_contents($path, $arquivoxml);
}
}
Got it buddy, I need to actually download everything at once, make it really simple for the end user. A button the user presses and the system does the rest. I have this in Delphi, I needed to have the same in php or in some other language that runs with apache on linux.
– Marco Pereira
while not dtmConexao.fdqXmlPdv.eof do
begin dtmConexao.fdqXmlPdvXML.SaveToFile('c:\teste\xml'+dtmConexao.fdqXmlPdvCHAVEXML.AsString+'.xml');
 dtmConexao.fdqXmlPdv.Next;
 end;
– Marco Pereira
PHP runs on the server side. You do not have access to the client machine. Your site can create a zip file with multiple files and make available as a download. But always the user of your site will need to download.
– jjuniob