Welcome Guest, Not a member yet? Register   Sign In
Why user cant download file?
#1

[eluser]tzi0[/eluser]
My files stored in /files folder (/files and /system in my home folder)
when i try to download file to user via this:

Code:
<?php
class Files extends Controller
    {
        function __construct()
        {
            parent::__construct();
            $this->load->helper('download');
            $this->tziauth->check();
        }
        function index()
        {
            $this->file();
        }
        function file($name="none")
        {
            $fname = "/files/".$name;

            ($name!="none" && file_exists($fname))
            {
                $data = file_get_contents($fname);
                force_download($name,$data);
            }
        }
        }

?>
i get an error message that says
Message: file_get_contents(/files/price.doc) [function.file-get-contents]: failed to open stream: No such file or directory
but price.doc exists! (
#2

[eluser]danmontgomery[/eluser]
use an absolute server path, not a web path.




Theme © iAndrew 2016 - Forum software by © MyBB