hi all
i am unable to download files from live server.
but it works fine on development server.
is there any server issue with it? do i have to unable or set any extension in phpmyadmin or php.ini?

First check should be whether your filenames are correct. Most issues arise when a development server runs on windows (NOT case sensitive), and the live server runs on *nix (case sensitive).

file names are correct

if(file_exixts($filename)){
echo "file exists";
//download
}
else{
echo "file does not exixts";
}

its showing file exists but not downloading it

Explain "not downloading", do you get an error ? What's happening, need more info ?

check your header

Explain "not downloading", do you get an error ? What's happening, need more info ?

no im not getting any error. download does not start on this page after printing "File exists"

<?php
$file = 'monkey.gif';

if (file_exists($file)) {
    echo "file exists";
    header('Content-Description: File Transfer');
    header('Content-Type: application/octet-stream');
    header('Content-Disposition: attachment; filename='.basename($file));
    header('Content-Transfer-Encoding: binary');
    header('Expires: 0');
    header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
    header('Pragma: public');
    header('Content-Length: ' . filesize($file));
    ob_clean();
    flush();
    readfile($file);
    exit;
}
?>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.