getVideoFile.php 641 B

123456789101112131415161718192021222324
  1. <?php
  2. if (isset($_POST["id"])) {
  3. include("../connectSQL_Component.php");
  4. $sql = "SELECT * FROM [BIMComponents].[dbo].[Video_Table] WHERE [id] = '" . $_POST["id"] . "'";
  5. $fetchResult = sqlsrv_query($conn, $sql);
  6. $file_name = "";
  7. $file_path = "";
  8. $title = "";
  9. while ($row = sqlsrv_fetch_array($fetchResult)) {
  10. $file_name = $row["file_name"];
  11. $file_path = $row["file_path"];
  12. $title = $row["title"];
  13. }
  14. $token = "../../." . $file_path;
  15. sqlsrv_close($conn);
  16. if (file_exists($token)) {
  17. echo $file_path;;
  18. } else {
  19. echo "Error: File Does not exists";
  20. }
  21. }