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

  • SEARCH
  • Home
  • 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 9253591
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T11:15:26+00:00 2026-06-18T11:15:26+00:00

Im trying to delete irrelevant files from the web folder and the script aint

  • 0

Im trying to delete irrelevant files from the web folder and the script aint working.

Here is the code:

<?php

    if(isset($_REQUEST['delete_file'])){

        if(isset($_GET['file_id'])){

$file_id = mysql_real_escape_string(strip_tags($_GET['file_id']));

    $file_info_query = @mysql_query("select * from video where id='$file_id'");
    $file_info_row = @mysql_fetch_assoc($file_info_query);
    $filename = $file_info_row['filename'];

        $path = $_SERVER['DOCUMENT_ROOT'].'/test2/video/';

        $file_path = $path;
        $file_path .= $filename;

            if(unlink($file_path))
            {
            echo "<p>File deleted successfully.</p> ";
            }
            else
            {
            echo "<p>Unable to delete file. Try again shortly.</p> ";
            }       

        }

    }



    ?>

Would be grateful getting this to work…Thank!

  • 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-18T11:15:28+00:00Added an answer on June 18, 2026 at 11:15 am

    Unlink function expects the complete server path of file. Please change your $path value to this one:

    $path = $_SERVER['DOCUMENT_ROOT'].'/test2/video/';
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im trying to Delete ALL Text files from a directory using a php script.
I'm trying to delete the folder mapeditor from my Java engine on GitHub here
I am trying to delete MySQL table rows from a Web page using Perl.
I'm trying to delete everything from a std::vector by using the following code vector.erase(
I'm trying to delete a folder and all files and folders within that folder,
I'm trying to delete a directory that contains XML files from a remote computer.
I am trying to delete an entry from a database have been unsuccessful. Here
I'm trying to delete a specific line by id from a file in C++
I'm trying to delete certain lines from a file. My file is a .txt
I am trying to delete the data present in the dataset with following code:

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.