turok 0 Denunciar post Postado Março 9, 2005 Estou tentando fazer o download de um arquivo.. em um servidor funciona e não outro não alguém sabe como resolver isto? Por favor me ajudem já postei isto aqui mas ninguém me ajudou e já faz tempo que to tentando resolver isto... xD Compartilhar este post Link para o post Compartilhar em outros sites
lukascolette 0 Denunciar post Postado Março 9, 2005 o q tem haver com o PHP? Compartilhar este post Link para o post Compartilhar em outros sites
turok 0 Denunciar post Postado Março 9, 2005 o código é em php... PHP [/tr][tr]$arquivo = "teste.txt"; $download_size = filesize($arquivo); $filename = basename($arquivo); header ("Content-type: application/txt"); header("Content-Length: $download_size"); header ("Content-disposition: attachment; filename=$filename;"); header ("Content-Description: Download File"); header("Content-Type: application/force-download"); @readfile("$arquivo"); [/tr] ah passo o nome do arquivo pela url tem alguma coisa haver com o endereço do arquivo? O arquivo fica no memso lugar em que a página com o cód. acima está Compartilhar este post Link para o post Compartilhar em outros sites
Senshi 0 Denunciar post Postado Março 9, 2005 tenta o seguinte:$arquivo = "teste.txt";$download_size = filesize($arquivo);$filename = basename($arquivo);header("Pragma: public");header("Expires: 0");header("Cache-Control: must-revalidate, post-check=0, pre-check=0");header("Cache-Control: public");header("Content-Description: File Transfer");header ("Content-type: application/txt");header ("Content-disposition: attachment; filename=$filename;");header("Content-Transfer-Encoding: binary");header("Content-Length: $download_size");@readfile("$arquivo"); Compartilhar este post Link para o post Compartilhar em outros sites
turok 0 Denunciar post Postado Março 9, 2005 Não funcionou.. fica carregando e não faz nada... tentei usar este PHP [/tr][tr]$arquivo = "teste.txt";header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); //header("Cache-Control: no-store, no-cache, must-revalidate"); sse uso dá problema no nome do arquivo header("Cache-Control: post-check=0, pre-check=0", false); header("Pragma: no-cache"); header("Content-type: application/x-msdownload"); header("Content-Disposition: attachment; filename=$arquivo"); readfile("$arquivo");[/tr] Salva o arquivo com o nome correto, mas com zero byte... é como se tentasse pegar o arquivo de algum lugar que não existe e dai gera um novo com o mesmo nome mas em branco.. Compartilhar este post Link para o post Compartilhar em outros sites