File "trash.php"

Full Path: /home/analogde/www/Prog/File explorer/trash.php
File size: 1.32 KB
MIME-type: text/x-php
Charset: utf-8

<?php

    //$file = "toto.txt";
    //$pos = strrpos($file,'.');
    //$ext = substr($file,$pos); 
    //$file_basename = substr($file, 0, strripos($file, '.')); // get file extention
    //echo " +++ " .$pos ."  "  .$ext . "   " .$file_basename;;

    echo "Current" .getcwd() ."<br><br>";
    
    $file = "Doc_uploads/07.jpg";

    $file = "/home/analogde/www/Fusion/File explorer/Mon projet.jpg";
    

   // $file = "analog-design.net/Fusion/File explorer/Kate-Upton.jpg";


    echo " ------>>>> " .$file ."<br><br>";
    //$file = "https://analog-design.net/Fusion/File explorer/Kate-Upton.jpg";

    if ( is_file($file) )  
    {
        echo "Bingo" ."<br><br>";

        echo " ++++++ " .basename($file) ."<br><br>";

        header('Content-Description: File Transfer');
        header('Content-Type: application/octet-stream');
        header('Content-Disposition: attachment; filename="' .basename($file) . '"');
        header('Content-Transfer-Encoding: binary');
        header('Connection: Keep-Alive');
        header('Expires: 0');
        header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
        header('Pragma: public');
        header('Content-Length: ' . filesize($file));
        readfile($file);
        exit;
    }
    else
    {
        echo "plouf";
    }

?>