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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T03:05:56+00:00 2026-06-10T03:05:56+00:00

I have the following code: $tmpfile = $tempDirectory . $file ; if (file_exists($tmpfile)) {

  • 0

I have the following code:

$tmpfile = $tempDirectory . $file ;

if (file_exists($tmpfile)) {

   header('Location: <some location>');

}

It works flawlessly, the file exists, I get redirected to my new page.

So, now I know that the file exists and works. So, I go into FTP, ensure the file is there.

Then I run this code:

$tmpfile = $tempDirectory . $file ;

if (file_exists($tmpfile)) {

   unlink($tmpfile);
   header('Location: <some location>');

}

Redirect stops working. PHP outputs nothing. The file gets deleted from the FTP directory. But the redirect completely fails.

If I put an echo inside the if statement when there is an unlink present (before or after any other line of code in the if statement, it outputs nothing.

There isn’t an unlink error, and the file is clearly deleted when I check FTP, so what is going on here?

It gets deleted when the code is run, so it’s obviously not a permission issue. It wouldn’t be able to delete the file if it didn’t have permissions to do so.

Any help is appreciated. Thanks!

  • 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-10T03:05:58+00:00Added an answer on June 10, 2026 at 3:05 am

    Solution may be simple:

    [blank space] - this breaks redirect
    <?php
    
    // code
    

    PHP may be also crashing on unlink. Make sure your error_reporint setting is set to E_ALL.

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

Sidebar

Related Questions

I have following code: public abstract class Operand<T> { public T Value { get;
Have following code: public interface ITest { string St1 { get; } } public
I have following code in the html file: <div class=navbar navbar-fixed-top> <div class=navbar-inner> <div
I have following code in .h file #import <UIKit/UIKit.h> @interface MessDisViewController : UIViewController {
I have the following vbscript code that returns the local IP address. It works
I have the following code: <? $serverurl = $_SERVER[DOCUMENT_ROOT]; $file = $serverurl.'/demo/sample_php.php'; $newfile =
I have following code: div.accountPage div.acct-form.login div.acct-header Log-in form.loginForm.login input(id=username, type=text, name=User, placeholder=Username, value=)
I have following code which works fine in iPhone application but in iPad I
I have following code in a Spring Dao which works just fine - Object
I have following code in initialization im = imread('Image02.tif'); figure(); imagesc(im); colormap(gray); [hImage hfig

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.