If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > PHP > unlink() function , not working

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-14-09, 16:21
danny_brazil danny_brazil is offline
Registered User
 
Join Date: Jul 2009
Posts: 19
unlink() function , not working

Hello

I have a problem with the unlink() function , its working when im using it like this:
Code:
$acao = $_POST['acao'];
if ($acao=='Excluir')
{
$file = $_POST['file'];
//$file_clean=substr ($file, 30);


$file_clean='ABVFP/uploads/43e509f5c9_knotthouse.jpg';
if(unlink("$file_clean")) echo "Deleted file ";
}
BUT i need to get the file name dynamically with a variable
and when im trying to use the variable it doesnt work any more
Code:
$acao = $_POST['acao'];
if ($acao=='Excluir')
{
$file = $_POST['file'];
$file_clean=substr ($file, 30);
--> here i get exactly this ABVFP/uploads/43e509f5c9_knotthouse.jpg

if(unlink("$file_clean")) echo "Deleted file ";
}
the original $file looks something like this :
http://www.mysite.com/abvfp/uploads/myfile.jpg

any reason why it doesnt accept the $file clean after it was substr

thanks
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On