GET_id not working in UnLink (delete file)
Discuss coding issues, and scripts related to PHP and MySQL.
-
JanMolendijk
- Posts: 282
- Location: Holland Rotterdam
GET_id not working in UnLink (delete file)
I searching for an hour for a solution; unlink seems not to work with GET id
Code: Select all
<?php
$id = (int) $_GET['id'];
echo $_GET['id'];
$file = fopen("'.$_GET['id'].'.txt","w");
echo fwrite($file,"Succesfully written document ticket);
fclose($file);
unlink("'.$_GET['id'].'.txt");
?>
Hope Coursesweb can help me out.
JanMolendijk
Here is an answer `o god after 2 hours shame on me for this one`
Code: Select all
<?php
$file_pointer = $_GET[file].'.txt';
if (!unlink($file_pointer)) {
echo ("File can’t be deleted!");
} else {
echo ("File deleted!");
}
?>
Similar Topics
-
The disable attribute in option tag not working
HTML - CSS
First post
I have designed a html page, but in option tag I have set disabled= true , still it is not disabling the option.
Things I have tried:
disabled=...
Last post
The attribute disabled sets without value (without ='true' ). You need just add this attribute into the options you want disabled.
<option...
-
Multiple select for upload not working on mobile
JavaScript - jQuery - Ajax
First post
Plessant Coursesweb,
meight useless to ask but it seems this upload for picture-album is not working on my mobile-page
but on my computer I just...
Last post
Try to search on the internet for:
html multiple select upload mobile
-
XAMPP-server only local host working
General Forum
First post
Dear Coursesweb,
I have a problem after round 10 hours searching I come to you for suport.
Only the local host is working: //127.0.0.1
But I...
Last post
OK thanks MarPlo.... Wishing overseas nice weekend
-
Access an XML file from different domain in JS
JavaScript - jQuery - Ajax
First post
I am creating a website with HTML and JavaScript that relies on the data of an XML file hosted on a separate domain.
I can achieve this with...
Last post
Try using the the fetch api.
fetch('//example.com/file_address')
.then( response => response.text() )
.then( response => {
//response is...