Change the file name after impact php



  • After the zip archive, the user needs to change his name. I do that.

    echo "http://site.com/modules/" . $file_name_zip;
    $new_file_name_zip = md5(time()).".zip";
    rename(ROOT . "modules/" . $file_name_zip, ROOT . "modules/" . $new_file_name_zip);
    

    Fill's renamed, but the user won't be able to get it, because somehow he's changed his name faster than he's giving up, and he gets a mistake. failed to open stream:

    The user's party accepts it by simply locating it to the server:

    copy($server_response, $install_zip)
    


  • Try giving your header the name of the file.

    header('Content-Disposition: attachment; filename="'.$new_file_name_zip.'"');


Log in to reply
 


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2