SitePoint Sponsor |
|
User Tag List
Results 1 to 3 of 3
Thread: Unlink() Assistance Please
-
Oct 21, 2003, 04:36 #1
- Join Date
- Dec 2001
- Posts
- 15
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Unlink() Assistance Please
I have a form where data and images can be uploaded. Everything works fine but when I delete the record I get an unlink() error if there was no file uploaded with the record becuase there's no file found to delete.
If there are 2 images uploaded then there are no errors cos unlink is happy its done its job
How can I stop the error? Maybe an else or if? I dunno how to do it tho
Here's my little bit of unlink code:
$imagedir = ("../../images");
$imagefile = ($row_DelRecord['Img1']);
$imagefile2 = ($row_DelRecord['Img2']);
unlink($imagedir . '/' . $imagefile);
unlink($imagedir . '/' . $imagefile2);
All I want to do is stop the error if there's only 1 file found or if there's none uploaded.
Thanks in advance
-
Oct 21, 2003, 07:16 #2
- Join Date
- Aug 2003
- Location
- Manchester, UK
- Posts
- 4,007
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
PHP Code:$imagedir = ("../../images" );
$imagefile = ($row_DelRecord['Img1']);
$imagefile2 = ($row_DelRecord['Img2']);
if(file_exists($imagedir.'/'.$imagefile)){
unlink($imagedir . '/' . $imagefile);
}
if(file_exists($imagedir.'/'.$imagefile2)){
unlink($imagedir . '/' . $imagefile2);
}
-
Oct 21, 2003, 07:25 #3
- Join Date
- Dec 2001
- Posts
- 15
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Thank you very much
Bookmarks