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
0
votes
2 answers

unlink() triggers open_basedir restriction. But every other function works

I have the following constant: FSROOT that is set as follows: getcwd(). I can use this constant everywhere in my app and don't have to worry about paths, for example: require_once(FSROOT . '/includes/php/something.php). However, I have recently…
Louis B.
  • 2,348
  • 1
  • 29
  • 51
0
votes
1 answer

Passing a variable from button to js within the same file

This code is supposed to pass the variable in the button delFunction to the delFunction script and delete the file associated with the button. It is not passing the variable. I insert two alert statements below the script and they display on the…
0
votes
2 answers

Zend framework passing hidden field and unlink file

I am working with Zend FW and deleting images from a form submitted in a view. I successfully delete all images name from the database, each one of them in the Array using their IDs. What I can't solve is once the names are deleted how do I unlink…
frapet
  • 229
  • 1
  • 4
  • 18
0
votes
2 answers

Intermittent unlink not functioning

The below code allows me to delete files SOMETIMES. I have checked permissions on the files and folders and they exist and are given proper access. Sometimes when I press the remove button; it removes the file and sometimes it simply refreshes the…
ILikeTurtles
  • 1,012
  • 4
  • 16
  • 47
0
votes
2 answers

Can't do unlink or chmod - permissions denied

I'm trying to chmod a file to 777 permissions and then delete it using unlink in PHP. However, I'm getting permissions denied error. I'm able to change the permissions when logged in via FTP in filezilla though. How do I fix this ?
Ashesh
  • 939
  • 2
  • 11
  • 28
0
votes
1 answer

PHP recursively removing folders

Here is function that I'm using for recursively deleting folders and files function rmdir_recursively($dir) { if (!is_dir($dir) || is_link($dir)) return unlink($dir); foreach (scandir($dir) as $file) { if ($file == '.' ||…
heron
  • 3,611
  • 25
  • 80
  • 148
0
votes
1 answer

How to use php function unlink to remove image from server?

I'm still trying to learn myself some more php and I'm currently working on a script to upload and remove images to and from my server. Now uploading is working all fine, also deleting from database isn't a problem. The only problem that occurs is…
Boudewijn Smit
  • 177
  • 2
  • 4
  • 13
0
votes
1 answer

Delete file selected in dropdown list

Trying to make a dropdown list, displaying files from a specific folder, with a Delete button to delete the file selected. Dropdown list:
denully
  • 215
  • 1
  • 2
  • 8
0
votes
2 answers

php file not unlinking

I am calling a .php file that lies within my 'uploads' directory to delete from the filesystem. The directories that need to be searched will always be inside "uploads/$_SESSION['email']". This is what I have…
V1GG3N
  • 309
  • 1
  • 6
  • 22
0
votes
3 answers

Deleting contents of all folders

I have a table with the names of all the folders I wish to delete the contents off. Now I have a script which will delete the entire contents of a folder that I set. Now I though I could put that code in a while loop and it would delete the contents…
user1555076
  • 327
  • 2
  • 5
  • 16
0
votes
1 answer

Cannot delete file in PHP

I've got a website that used to store data in text form (before aquiring db) so now I have a problem deleting a file... The file has a single quote char in it's name, ("I'mHere.txt"), the site file manager can't delete this file, and it's getting…
user1126068
0
votes
2 answers

How to take first file name from a folder and delete it in PHP

I try to make a gallery. In a folder I have some duplicate pictures. I have pictures named: af_160112, af_160113, af_160114. I would like remove this first one. How to take the first picture in a folder and delete it? So far I have known that I…
Delicja
  • 193
  • 1
  • 8
  • 18
0
votes
1 answer

php delete file.pdf before packaging

How do I go about deleting instructions.pdf from a temp directory? My web script creates temporary folders with a unique id and requests some files from another server. One such file is "instructions.pdf". I want to delete this file before the…
Moh ali
  • 31
  • 1
  • 1
  • 6
0
votes
4 answers

When do you have permission to use unlink()?

I'm trying to predict which files I can delete using unlink(). My understanding so far is that the file must either be writeable to others, or have the same group id or owner id as the executing program. Are there any other cases? I'm trying to…
emrosenf
  • 87
  • 5
-1
votes
2 answers

"unlink" does not work on local Wordpress instance?

I'm trying to modify a plugin so that image files from a directory can be deleted with an html link. My code spits out a table containing an image thumbnail, a link to the image, and a link to delete the file:
Nicholas Arehart
  • 135
  • 2
  • 13