Ashnas Salim
Ashnas Salim

Reputation: 1

How to change the owner of a file when download it to server

    $file_name_with_full_path = './chitty/insurance/lic/'.$filename;
    header('Content-type: application/xls');
    header("Content-Disposition: attachment; filename=".$filename);
    header("Pragma: no-cache");
    header("Expires: 0");
    header('Cache-Control: public');

    if(file_exists('./chitty/insurance/lic/'.$filename))
        unlink('./chitty/insurance/lic/'.$filename);

    $xx=fopen("./chitty/insurance/lic/".$filename,"w");
    chmod("./chitty/insurance/lic/".$filename,0755);    
    chown($file_name_with_full_path, "devuser");        // change owner
    fwrite($xx,$excltable);
    fclose($xx);

I use chown() function, but it didn't work.Please help me to solve this

Upvotes: 0

Views: 31

Answers (0)

Related Questions