Reputation: 49
I'm trying to delete specific file name into a folder depend of the action of the user and I receive this warning:
Warning: unlink(): http does not allow unlinking in
This is the code that have the button that provide the navigation to the deleteRecord.php
> <script> //btn delete
> $(".btn_delete").click(function(){
> var id = $(this).closest('tr').children('td:first').text();
> //alert(id);
> var x;
if (confirm("Are you sure you want delete this record?") == true) {
> //alert ("You pressed OK!");
>
> location.href='deleteRecord.php?filename='+filename;
> } else {
> //alert ("You pressed Cancel!");
> return false; }
> });
> </script>
This work very good I put it to show to where come the variable id
And now this is the php page that return the Warning:
$filename = $_GET['filename']; //get the filename like "yo.jpg"
$path = "http://www.here I have the exact address to the folder/";
unlink($path . '/' . $filename);
and this is the result I will put it again!
******Warning: unlink(): http does not allow unlinking in******
Any suggestions? Any advice? Please sorry about my english, I'm learning!
Upvotes: 0
Views: 80
Reputation: 712
You need to pass the server's path to the file as the argument to unlink()
rather than the URL, for example:
unlink('/var/www/mywebsite.com/images/myimage.jpg')
Upvotes: 3