Advertisement
kura2yamato

viewFile.php

Mar 9th, 2025 (edited)
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.65 KB | Source Code | 0 0
  1. <?php
  2. /*
  3. location: ajax/
  4. */
  5. include "../configs/base.php";
  6. include_once "../functions/_main.php";
  7. $json = decryptData($_POST["params"]);
  8. $arData = json_decode($json);
  9. //print_r($json);
  10. $folder = folderAttachment(
  11.     $arData->folder ?? "demo",
  12.     $arData->date ?? "2024-12-12"
  13. );
  14.  
  15. $aFile = explode("/", $arData->filename ?? "none.tmp");
  16. $file_url = $folder . "/" . end($aFile);
  17. $txt = file_get_contents($file_url);
  18.  
  19. header("Content-Type: application/octet-stream");
  20. header("Content-Transfer-Encoding: Binary");
  21. header(
  22. "Content-disposition: attachment; filename=\"" . basename($file_url) . "\""
  23. );
  24. //readfile($file_url);
  25. die($txt);
Tags: php
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement