Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8033273
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T01:38:45+00:00 2026-06-05T01:38:45+00:00

I have an issue here, I’m not sure if it’s possible but I would

  • 0

I have an issue here, I’m not sure if it’s possible but I would like to delete a file when the user leaves the page… I currently have a php script (see below) which handels the deleting of a file, but i don’t know how to run it when the page unloads?

<?php
include 'js/db/db.php';
$film = $_GET['film'];
$movie = $_GET['org_film'];
$user = $_COOKIE['user'];
$filename = "movies/".$user."/".$film.".mp4";
if (file_exists($filename)) {
    unlink($filename);
    header('location: storage.php');
}
else{
    $filename = "movies/".$user."/".$film.".m4v";
    if (file_exists($filename)) {
        unlink($filename);
        header('location: storage.php');
    }
    else{
        echo " file doesn't Exist"; 
    }
}
?>

Any ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T01:38:48+00:00Added an answer on June 5, 2026 at 1:38 am

    From your code it looks like you’re creating a temporary file so that you can deliver a video to a specific user for a specific amount of time. This is a highly inefficient approach. You’d be better off:

    1. Using your database to track which users have access to which videos, and how how long
    2. On a request to the video page, assert that the user has the right to access that file and, if the assertion passes, generate a signed url which is valid only for a short period of time and which may be used in the video page to deliver your movie.

    A signed URL would look something like:

    http://path.to/your/movie.m4v?timestamp=2309583240&signature=234p9345u234234092wjdfl
    

    Where timestamp is the current UNIX timestamp and signature is a SHA1 hash of the timestamp and some secret known only to your application.

    Amazon S3 supports this feature – you could also store the movie files on Amazon S3 with limited read privileges, and use one of the many popular S3 libraries to generate time-limited signed URLs for your users.

    This would obviate the need to shift large files around the disk, and thereby greatly increase performance. It would also scale better as the maximum concurrent viewers would no longer by tied to disk size.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm not sure if I have a threading issue here or not. On the
Having an issue here that I have tried everything I can think of but
Have another issue here. Our app starts out with a tab activity. But, before
I have been trying to find this issue here, but no topic seems to
I have a similar issue like here: http://social.msdn.microsoft.com/forums/en-US/biztalkgeneral/thread/87d5a6ec-04ee-4c6f-8267-f526ee105f0b I have an asp.net web page
I have a strange issue here with my Django app. I implemented the user
Before anyone jumps on me, I have found a similar issue here , but
I think I have the same issue as here , but can't quite get
I have a curious issue here In my ejbCreate() method from where i insert
I'm have a weird issue here. I have a UITableView using custom UITableViewCells. Everything

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.