[PHP] Re: Can't Delete File Using Unlink

2005-04-11 Thread Ben Ramsey
Ahmed Abdel-Aliem wrote:
i have a problem with deleting files, i use windows XP and installed
on it apache server  PHP 5.1
i use unlink($file) to delete files but it doesn't work while it works
fine on my webhosting which is on linux machine
is there another function to use to delete files under windows instead
of link ??
The webserver needs to have permission to modify the file that you are 
trying to delete. Check the file and directory permissions by 
right-clicking the directory and going to properties. You will probably 
need to give the user that controls apache either full or modify 
permissions to the Web directory.

In general, permission settings under Windows suck.
--
Ben Ramsey
http://benramsey.com/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: Can't Delete File Using Unlink

2005-04-11 Thread Ahmed Abdel-Aliem
On Apr 11, 2005 8:28 PM, Ben Ramsey [EMAIL PROTECTED] wrote:
 Ahmed Abdel-Aliem wrote:
  i have a problem with deleting files, i use windows XP and installed
  on it apache server  PHP 5.1
  i use unlink($file) to delete files but it doesn't work while it works
  fine on my webhosting which is on linux machine
  is there another function to use to delete files under windows instead
  of link ??
 
 The webserver needs to have permission to modify the file that you are
 trying to delete. Check the file and directory permissions by
 right-clicking the directory and going to properties. You will probably
 need to give the user that controls apache either full or modify
 permissions to the Web directory.
 
 In general, permission settings under Windows suck.
 


i tried that, when a file is being uploaded it becomes read-only, so
it can't be deleted, how can i make it not read-only by default ?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: Can't Delete File Using Unlink

2005-04-11 Thread Jason Wong
On Tuesday 12 April 2005 02:28, Ben Ramsey wrote:

 In general, permission settings under Windows suck.

Hmm I thought that the ACLs on NTFS were about the only thing that is good 
about Windows.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
New Year Resolution: Ignore top posted posts

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Can't Delete File Using Unlink

2005-04-11 Thread Ben Ramsey
Ahmed Abdel-Aliem wrote:
On Apr 11, 2005 8:28 PM, Ben Ramsey [EMAIL PROTECTED] wrote:
Ahmed Abdel-Aliem wrote:
i have a problem with deleting files, i use windows XP and installed
on it apache server  PHP 5.1
i use unlink($file) to delete files but it doesn't work while it works
fine on my webhosting which is on linux machine
is there another function to use to delete files under windows instead
of link ??
The webserver needs to have permission to modify the file that you are
trying to delete. Check the file and directory permissions by
right-clicking the directory and going to properties. You will probably
need to give the user that controls apache either full or modify
permissions to the Web directory.
In general, permission settings under Windows suck.

i tried that, when a file is being uploaded it becomes read-only, so
it can't be deleted, how can i make it not read-only by default ?
Can you post the code you're using to upload and save the file to the 
Web server?

--
Ben Ramsey
http://benramsey.com/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: Can't Delete File Using Unlink

2005-04-11 Thread Ahmed Abdel-Aliem
On Apr 11, 2005 8:39 PM, Ben Ramsey [EMAIL PROTECTED] wrote:
 Ahmed Abdel-Aliem wrote:
  On Apr 11, 2005 8:28 PM, Ben Ramsey [EMAIL PROTECTED] wrote:
 
 Ahmed Abdel-Aliem wrote:
 
 i have a problem with deleting files, i use windows XP and installed
 on it apache server  PHP 5.1
 i use unlink($file) to delete files but it doesn't work while it works
 fine on my webhosting which is on linux machine
 is there another function to use to delete files under windows instead
 of link ??
 
 The webserver needs to have permission to modify the file that you are
 trying to delete. Check the file and directory permissions by
 right-clicking the directory and going to properties. You will probably
 need to give the user that controls apache either full or modify
 permissions to the Web directory.
 
 In general, permission settings under Windows suck.
 
 
 
 
  i tried that, when a file is being uploaded it becomes read-only, so
  it can't be deleted, how can i make it not read-only by default ?
 
 Can you post the code you're using to upload and save the file to the
 Web server?
 

this is the function i am using to upload the file 

function UploadFile($File) {

$this-File = $File;

$this-File_Name = strtolower($this-File['name']);

$SQL_Query = mysql_query(SELECT * FROM files WHERE file_name =
'$this-File_Name');
$Records = mysql_num_rows($SQL_Query);



$arr = split(\.,$this-File['name']);

if($Records  0){


$dst_file_name = $this-GenerateUniqueID();

$this-File['name'] =
$this-File['name'].$dst_file_name[1].$dst_file_name[5];
$this-File['name'] .= ..$arr[count($arr)-1];

}
$this-File_Ext = $arr[count($arr)-1];

$dest_dir = 'files';
$dest = $dest_dir . '/' .$this-File['name'];
$r = move_uploaded_file($this-File['tmp_name'], $dest);
$this-File_Name = $this-File['name'];
chmod(files/.$this-File_Name, 777);  

}


the partition the server on is Fat32

hop i will find a way to solve this, thanks
-- 
Ahmed Abdel-Aliem
Web Developer
www.ApexScript.com
0101108551
registered Linux user number 382789

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: Can't Delete File Using Unlink

2005-04-11 Thread Josip Dzolonga
On , 2005-04-11 at 14:28 -0400, Ben Ramsey wrote:
 The webserver needs to have permission to modify the file that you are 
 trying to delete. Check the file and directory permissions by 
 right-clicking the directory and going to properties. You will probably 
 need to give the user that controls apache either full or modify 
 permissions to the Web directory.

That's correct. And also, are you using double slashes \\ instead of a
single slash / ? 

Josip Dzolonga
http://josip.dotgeek.org 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Can't Delete File Using Unlink

2005-04-11 Thread Ben Ramsey
Ahmed Abdel-Aliem wrote:
		chmod(files/.$this-File_Name, 777);	
I'm not really sure how chmod() works on Windows. Someone else here may 
be able to answer that. However, I do know that chmod() expects an octal 
as the second argument, so you must prefix that 777 with a 0. It should be:

chmod(files/.$this-File_Name, 0777);
See here for more info: http://us2.php.net/chmod
Like I said, I'm not sure whether this is the cause of the problem, but 
give it a shot and see what happens. :-)

--
Ben Ramsey
http://benramsey.com/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re: Can't Delete File Using Unlink

2005-04-11 Thread John Nichel
Ahmed Abdel-Aliem wrote:
snip
$dest = $dest_dir . '/' .$this-File['name'];
$r = move_uploaded_file($this-File['tmp_name'], $dest);
$this-File_Name = $this-File['name'];
chmod(files/.$this-File_Name, 777); 
I haven't messed with PHP/Apache on Windows in a long time but two 
things stick out to me that _may_ be a part of your issue.

a)  Can you even chmod on Windows?
b)  Paths in the MS world are with the backslash (\) and not the forward 
slash (/)

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re: Can't Delete File Using Unlink

2005-04-11 Thread Ben Ramsey
John Nichel wrote:
b)  Paths in the MS world are with the backslash (\) and not the forward 
slash (/)

Windows NT onward (XP, 2003, etc.) should understand both the forward 
slash and the backslash in a file path.

--
Ben Ramsey
http://benramsey.com/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re: Can't Delete File Using Unlink

2005-04-11 Thread Maerlyn
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
 
John Nichel wrote:

 Ahmed Abdel-Aliem wrote: snip

 $dest = $dest_dir . '/' .$this-File['name']; $r =
 move_uploaded_file($this-File['tmp_name'], $dest);
 $this-File_Name = $this-File['name'];
 chmod(files/.$this-File_Name, 777);


 I haven't messed with PHP/Apache on Windows in a long time but two
 things stick out to me that _may_ be a part of your issue.

 a) Can you even chmod on Windows? b) Paths in the MS world are
 with the backslash (\) and not the forward slash (/)

a, chmod doesn't work in Windows, but if you have NTFS then you can
set privileges.
b, Windows NT and later versions unterstand both / and \

Maerlyn

- --
Maerlyn
maerlyn[AT]citromail[DOT]hu
http://putraware.ini.hu
GnuPG Public Key ID: 0x0CE0A57
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (MingW32)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
 
iD8DBQFCWsodMkyacQzgalcRAvtqAKCJjy0rUVykpsmzJRyUA1cfkdHMxwCgwjkl
72boetSgh8V5gdK5QuPS9Gw=
=XQgB
-END PGP SIGNATURE-

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: Can't Delete File Using Unlink

2005-04-11 Thread John Nichel
Ben Ramsey wrote:
John Nichel wrote:
b)  Paths in the MS world are with the backslash (\) and not the 
forward slash (/)

Windows NT onward (XP, 2003, etc.) should understand both the forward 
slash and the backslash in a file path.

Like I said, it's been a loong time ;)
--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php