Questions tagged [unlink]

Refers to removing a file from a filesystem.

This tag is appropriate for questions about deleting a file from a filesystem whether by using a language-specific function such as Perl or PHP's unlink or by making a system call such as Unix's unlink.

Wikipedia has more information about unlink.

526 questions
-2
votes
2 answers

Warning: unlink($name): Permission denied

First of all, I'll request to not mark my question as duplicate. Because I have googled my problem a lot and didn't find solution of my problem. There is a lot of problem of permission denied on unlink but my problem for this is totally different.…
Zain Shabir
  • 79
  • 3
  • 11
-2
votes
1 answer

Delete a file with php and sweet alert 2

i have this script, to show alla images in a folder and also i have a delete button/link under all the thumbnails. I click this delete button/link to display a Sweet alert 2 confirmation box, and if i click OK(Ja, Radera!) the unlink.php file is…
Patrik Idén
  • 355
  • 4
  • 14
-2
votes
2 answers

can't unlink image which is in url format

php is getting image in following format, while echoing $_POST['img'] http://localhost/uploads/images/1533033949-8.jpg But why unlink doesn't working - // Get src. $img = $_POST["img"]; // Check if file exists. if (file_exists(getcwd() . $img))…
Dipak
  • 931
  • 14
  • 33
-2
votes
2 answers

PHP unlink file with no extension

I am trying to unlink files in a Directory which have no extensions. I did following, but did not work: $fileInfo = pathinfo($this->outputPath); if($fileInfo['extension'] == NULL) { …
Olipol
  • 315
  • 1
  • 9
  • 19
-2
votes
1 answer

how to delete a specific image in folder with symfony using unlink()?

I want to delete a specific image file in the folder web/img/users , i wrote this code : $path = $this->get('kernel')->getRootDir() . '/../web/img/users'; unlink($path."".($employee->getImageName())); but i have this error: Warning:…
-2
votes
2 answers

Unlink all but one filetype

How can I remove ALL but .sql file extensions in a specific folder with php? It's a php file that is supposed to create a backup of the database and place it in a back up folder but if there are any .jpg or any other extensions it should remove them…
Momo
  • 11
-2
votes
2 answers

How to Delete few older images using php?

I want to delete images from a specific category that are older than a certain age (say, 2 months). These images are located in directory somewhere, if I use the following code:
Hafiz Usman aftab
  • 300
  • 2
  • 5
  • 15
-2
votes
1 answer

Php delete all jpg but 20 newest

So.. I've been looking around, but not really found what I need, so here goes: I got a webcam set to upload jpg's to a folder, but to avoid my server getting overflown with files, I want to clean out all jpg's but 20 newest when I load the page that…
Christian
  • 3
  • 2
-2
votes
2 answers

unlink base64 encoded image not working

hi guys ive created a base64 encoded image captured with web cam now i convert the .png to .jpg all works fine but now i get two images on server both .png and .jpg how do i go about deleting the .png or is their a way to convert to jpg without…
-2
votes
1 answer

php unlink not deleting file but changing owner and permissions

I have looked at most of the suggested questions but can't find the answer I need. I am using cakephp 2.x and I have a controller function as follows: public function removeImage($image) { $p =…
khany
  • 1,167
  • 15
  • 33
-2
votes
2 answers

Can't delete a file in PHP

I can't delete a file using unlink() and when I use fopen with the "w" tag, I get an error. The file has 777 chmod. I can use fopen() to write at the end of the file. But I can't delete anything. Can anybody help me please? Here's a sample: echo…
user1319182
  • 481
  • 12
  • 26
-3
votes
1 answer

PHP: Deleting the "body" of the file even there's a similar file name

I am creating a PHP Program where it will delete the file inside a folder and i am using unlink() but after reading about unlink() it seems like it will not delete the "body" of the file if there is a file with a similar name even it is on a…
Punky
  • 31
  • 10
-3
votes
1 answer

unlink a file in a lower directory

I am trying to find a solution to remove files from a directory listing. I found an example that works bery well for files within the same directory. However I assume that I would need to change directories but I am not understanding how to…
-3
votes
1 answer

Why does this unlink function not work?

I want the user to be able to delete a file by clicking on a checkbox and submitting the form. Somewhere in the header: foreach ($_POST ['files'] ['deleteFile'] as $value) { unlink ($value); $fileError = '¡Éxito!'; } Somewhere…
-3
votes
4 answers

unlink called autmatically whenever the page refreshed

i'v an issue with unlink function in php , i'v a delete script where i click on a delete button it deletes an image ID from the table , but when i add the unlink function to the same button it automatically deletes the image but the ID remains which…
Kosh
  • 6,140
  • 3
  • 36
  • 67
1 2 3
35
36