tallberg Posted December 15, 2006 Share Posted December 15, 2006 Hi i want to delete file in a certain dir. When i use the following code i am unable to open file in the dir call uploaded.If this is a permision thing, how do i changing the dir and file permissions on a wamp set up on windows?$myFile = "dfd.jpg";$fh = fopen(uploaded/$myFile, 'w') or die("can't open file");//fclose($fh);//unlink($myFile);This the error message.Warning: Division by zero in C:\wamp\www\httpdocs\catalogue2\unlink.php on line 10can't open fileThanks in advance Link to comment https://forums.phpfreaks.com/topic/30762-opening-and-deleting-files/ Share on other sites More sharing options...
complex05 Posted December 15, 2006 Share Posted December 15, 2006 Hey Tallberg,I would recommend installing an FTP server on your machine, such as Serv-U or FileZilla and use their functions to manipulate permissions.Hope that helps,Barry Link to comment https://forums.phpfreaks.com/topic/30762-opening-and-deleting-files/#findComment-141770 Share on other sites More sharing options...
timmah1 Posted December 15, 2006 Share Posted December 15, 2006 This is what I have, and it works fine[code]$tmpfile = "$file";unlink($tmpfile); [/code] Link to comment https://forums.phpfreaks.com/topic/30762-opening-and-deleting-files/#findComment-141777 Share on other sites More sharing options...
tallberg Posted December 15, 2006 Author Share Posted December 15, 2006 That works for me too but not in another dir. Link to comment https://forums.phpfreaks.com/topic/30762-opening-and-deleting-files/#findComment-141824 Share on other sites More sharing options...
kenrbnsn Posted December 15, 2006 Share Posted December 15, 2006 Change this line:[code]<?php$fh = fopen(uploaded/$myFile, 'w') or die("can't open file");?>[/code]to[code]<?php$fh = fopen('uploaded/' . $myFile, 'w') or die("can't open file");?>[/code]The problem is that you didn't quote the fixed part of the filename and PHP thought you were trying to perform a division statement.Ken Link to comment https://forums.phpfreaks.com/topic/30762-opening-and-deleting-files/#findComment-141922 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.