getting the path of a file from its grandparent folder

Posted by Saswat on Stack Overflow See other posts from Stack Overflow or by Saswat
Published on 2012-04-07T17:19:48Z Indexed on 2012/04/07 17:30 UTC
Read the original article Hit count: 304

Filed under:
|

i have a php file which has the followng path

Shubhmangalam/admin/welcome_image_edition/delete_image.php

and an image file with the follwing path

Shubhmangalam/welcome_images/image_1.jpg

i want to delete the image_1.jpg file which i know can be done by using unlink() method.. but the prob is that the parent folder of the .php file and .jpg file is different, and so is their level of file-system...and i cant find the proper way to get the path to delete the image_1.jpg file.

now the code on the delete_image.php is accordingly

<?php
$image=$_REQUEST['image'];
if(unlink("./../welcome_images/".$image))
   echo "Successfully Deleted";
else 
   echo "Wrong";
?>   

now the above is server-scripting code, i want to delete the image by getting appropriate path.. i dnt want the actual path, but the path from the project folder that is Shubhmangalam

thanks in advance

© Stack Overflow or respective owner

Related posts about php

Related posts about relative-path