Welcome Guest, Not a member yet? Register   Sign In
File name

Hi I am trying to get the file name from the URL to pass it to force_download() function how do i do that?

Here is how the url looks base_url('downloads/file1.mp3'). When i click on the file name i get 404 page not found. I have the download.php which includes the following code:
if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Downloads extends CI_Controller
    public function index()
    $data = file_get_contents('./application/views/uploads/file1.mp3');
    $name = 'file1.mp3';
    force_download($name, $data);

Now instead of file1.mp3 in the file_get_contents('./application/views/uploads/file1.mp3') i want to store the name portion in a variable $fileName and then pass it to file_get_contents.

Thanks in advance.

Messages In This Thread
File name - by El Forum - 09-13-2011, 11:32 AM

Theme © iAndrew 2016 - Forum software by © MyBB