Welcome Guest, Not a member yet? Register   Sign In
force_download problem?
#1

[eluser]Unknown[/eluser]
Hi! Im new on this Framework and Forum and I'm looking for someone who can help me.

I have a problem with the helper download. I was trying to download a text file with a special extension(the specific of my application) from my webpage, but the function force_download enter a blank space at the beginning of the file content. Is it possible that this problem was caused by the extension? Is this any bug, what i should do?

The code of the controller is this:


Code:
function descarregar(){
      $this->load->helper('download');
      
      $name=$this->input->post('descarregarPOGO');
      $base_url='/opt/lampp/htdocs/uploads/';
      $url=$base_url.$name;

      $data=file_get_contents($url);

      force_download($name,$data);
    }

I put an echo of $data in this piece of code and the result seams to be correct, in $data figures the content of the file without the blank space.

Thank you for your help and sorry about my english!
#2

[eluser]Unknown[/eluser]
It seams that I output a blank space before exit($data);

I solved my problem adding the function ob_clean(); before exit($data); line on the force_download function of CodeIgniter Framework.




Theme © iAndrew 2016 - Forum software by © MyBB