Skip to main content
AI Assist is now on Stack Overflow. Start a chat to get instant answers from across the network. Sign up to save and share your chats.

How do I delete a file, for example: 22.pdf from my server with PHP if the file is in an otheranother directory?

Here is my page layout: projects/backend/removeProjectData.php (this file deletes all my entries for the database and should also delete the related file)

  • projects/backend/removeProjectData.php (this file deletes all my entries for the database and should also delete the related file)
  • public_files/22.pdf (the place where the file is located.)

I'm using the public_files/22.pdfunlink (the place where the file is located.)function:

Now I'm using the unlink('../../public_files/' . $fileName);

But this always gives me an error that the file does not exist any. Any ideas?

How do I delete a file, for example: 22.pdf from my server with PHP if the file is in an other directory?

Here is my page layout: projects/backend/removeProjectData.php (this file deletes all my entries for the database and should also delete the related file)

public_files/22.pdf (the place where the file is located.)

Now I'm using the unlink('../../public_files/' . $fileName);

But this always gives me an error that the file does not exist any ideas?

How do I delete a file from my server with PHP if the file is in another directory?

Here is my page layout:

  • projects/backend/removeProjectData.php (this file deletes all my entries for the database and should also delete the related file)
  • public_files/22.pdf (the place where the file is located.)

I'm using the unlink function:

unlink('../../public_files/' . $fileName);

But this always gives me an error that the file does not exist. Any ideas?

Question Protected by CommunityBot
edited tags
Link
tshepang
  • 12.5k
  • 25
  • 98
  • 140
added 1 character in body; edited tags; edited title
Source Link
Sam
  • 7.4k
  • 16
  • 48
  • 68

how How to delete a file via PHP?

How do I delete a file, for example: 22.pdf from my server with PHP if the file is in an other directory?

Here is my page layout: projects/backend/removeProjectData.php (this file deletes all my entries for the database and should also delete the related file)

public_files/22.pdf (the place where the file is located.)

nowNow I'm using the unlink('../../public_files/' . $fileName);

But this always gives me an error that the file does not exist any ideas?

how to delete a file via PHP

How do I delete a file, for example: 22.pdf from my server with PHP if the file is in an other directory?

Here is my page layout: projects/backend/removeProjectData.php (this file deletes all my entries for the database and should also delete the related file)

public_files/22.pdf (the place where the file is located)

now I'm using the unlink('../../public_files/' . $fileName);

But this always gives me an error that the file does not exist any ideas?

How to delete a file via PHP?

How do I delete a file, for example: 22.pdf from my server with PHP if the file is in an other directory?

Here is my page layout: projects/backend/removeProjectData.php (this file deletes all my entries for the database and should also delete the related file)

public_files/22.pdf (the place where the file is located.)

Now I'm using the unlink('../../public_files/' . $fileName);

But this always gives me an error that the file does not exist any ideas?

added 22 characters in body
Source Link
Eric Leschinski
  • 155.3k
  • 96
  • 423
  • 337
Loading
deleted 13 characters in body
Source Link
gen_Eric
  • 227.7k
  • 42
  • 304
  • 343
Loading
Source Link
Ken
  • 2.8k
  • 4
  • 26
  • 29
Loading