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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T08:12:55+00:00 2026-06-10T08:12:55+00:00

I am using this function. is_file and is_writable return true, but when I true

  • 0

I am using this function. is_file and is_writable return true, but when I true to unlink, it gives an error. This is on windows server.

if(is_file($fileToDelete)) {
  if(is_writable($fileToDelete)) {
    unlink($fileToDelete);
  }
}

The file is a PDF document, which I have open. I thought is_writable would return false in this case, but it doesn’t.

So how can I tell if a file can be deleted or not?

Thank you

  • 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-10T08:12:56+00:00Added an answer on June 10, 2026 at 8:12 am

    What about doing it the other way around? Just try to delete the file and check whether it is really gone?

    @unlink($fileToDelete);
    
    if(is_file($fileToDelete)) {
       // file was locked (or permissions error)
    }
    

    Not sure whether this is workable in your specific case though, but judging by the code in your question this should be what you want.

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

Sidebar

Related Questions

This is the file I'm using $.load() to load into DOM: <script type=text/javascript> $('.close').click(function()
I am using this function but it is not working. I'm using StoryBoard and
In my index file I get data from the database using this function (which
I have one page using this function to check if one file is on
I am using following code to get bitmap from url. This function is used
This Javascript code is using the 'this' keyword inside a nested function (which is
I'm using this: jQuery('.class1 a').click( function() { if ($(.class2).is(:hidden)) { $(.class2).slideDown(slow); } else {
Hai I am using codeigniter...I my function phpcalview() ... This is my function function
This is a sample function to send an email using Gmail public void sendEmail(String
Why is this in an anonymous function undefined when using javascript in strict mode?

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.