<?php

if(core::ifPost("from")){
    header('Content-type: application/octet-stream;');
    header('Content-Transfer-Encoding: base64');
    header('Content-Disposition: attachment; filename="'.core::getPost("file").'"');

    historique::recRef("/proweb-export-csv.html");
    historique::add(array(
        "idType" => historique::getIdRef("ACTION"),
        "idUser" => session::getId(),
        "idPage" => historique::getIdRef("/proweb-export-csv.html"),
        "log" => "Téléchargement du fichier local ". core::getPost("file")
    ));

    readfile(SFTP_LOCAL.core::getPost("file"));
}
