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 8446195
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T09:51:53+00:00 2026-06-10T09:51:53+00:00

I make a site and it has this feature to upload a file and

  • 0

I make a site and it has this feature to upload a file and that file is uploaded to a server

Im just a newbie to php I download xampp and I run this site that i made in my local machine.
My site is like this you upload a file then that file will be uploaded to a server, but when i tried unlink() because when i try to remove the filename to a database I also want to remove that pic on the server, but instead I got an error and it says “Permission denied”.

question:

How can I got permission to use unlink();?

I only run this on my localmachine using xampp

  • 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-10T09:51:54+00:00Added an answer on June 10, 2026 at 9:51 am

    Permission denied error happens because you’re trying to delete a file without having enough/right permissions for doing that.

    To do this you must be using superuser account or be the same user that have uploaded the file.

    You can go to the directory from your command line and check the permissions that are set to the file.

    The easiest solution is to loggin as administrator/root and delete the file.

    Here is another work around:

    // define if we under Windows
    $tmp = dirname(__FILE__);
    if (strpos($tmp, '/', 0)!==false) {
      define('WINDOWS_SERVER', false);
      } else {
      define('WINDOWS_SERVER', true);
    }
      $deleteError = 0;
      if (!WINDOWS_SERVER) {
        if (!unlink($fileName)) {
          $deleteError = 1;
        }
      } else {
        $lines = array();
        exec("DEL /F/Q \"$fileName\"", $lines, $deleteError);
      }
      if ($deleteError) {
        echo 'file delete error';
      }
    

    And some more: PHP Manual, unlink(), Post 106952

    I would recommend, always first to check PHP Manual (in case your question concerns PHP), just go to the page with function that you have problems with and just click search CTRL+F in your browser and enter, for example, Windows, and as a result, in your case, you would find at least 7 related posts to that or very close to that what you were looking for.

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

Sidebar

Related Questions

I'm trying to make a WordPress site that has six lists on a page,
Is it possible to make a PHP application think that the server datetime is
From Google Make sure your web server supports the If-Modified-Since HTTP header. This feature
Referring to this web site http://www.cplusplus.com/reference/std/utility/make_pair/ The std::make_pair has this signature (and possible implementation):
Why my text has the justify effect? In my whole site, I make echos
i'm trying to make my site with a few languages. Every page includes config-file,
My company is looking at various PHP frameworks to build a customer's site. This
Everyone on this site has been very helpful on my schooling of iOS programming,
I am trying to implement an admin feature on my site that allows an
The administrator has installed Xdebug 2.1.1 in our shared PHP 5.3.0 server in order

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.