LIGHT
LIGHT

Reputation: 5712

File not found issue in php

<?
header("Content-type: octet/stream");
header("Content-Transfer-Encoding: Binary");
header("Content-disposition: attachment; filename=a.mp3");
readfile("http://adstorage.jamba.net/storage/view/325/0/fa/Fairytale.mp3");
?>

This code is working great in my localhost but displays File not found when uploaded to my server

Upvotes: 0

Views: 603

Answers (3)

Tim
Tim

Reputation: 8616

I don't think the code you've posted has anything to do with the 404. A code error with your mp3 download would not produce a 404.

Chances are your CodeIgniter setup is wrong/different on your remote host. Check the routing is working. Do other controllers work?

Upvotes: 0

Veger
Veger

Reputation: 37905

Do you have PHP permissions to read external files?

These permissions might be different on your local machine and the web server.

According to the readfile() documentation:

A URL can be used as a filename with this function if the fopen wrappers have been enabled. See fopen() for more details on how to specify the filename. See the Supported Protocols and Wrappers for links to information about what abilities the various wrappers have, notes on their usage, and information on any predefined variables they may provide.

Upvotes: 2

RaJeSh
RaJeSh

Reputation: 313

*Please set the file permission so only it can be working correctly.. *

Upvotes: 0

Related Questions