Just open the file in mode "w".
$fp = fopen("your_file", "w");
There is also the the function fseek(), which
will allow you to move the file pointer around
to any place in the file. Mode "w" will
suffice for your needs.
fopen() - http://www.php.net/manual/en/function.fopen.php
fseek() - http:
On Monday 03 June 2002 23:37, Jas wrote:
> Not sure how I could do this as I could not find a functions on php.net to
> allow me to first delete the entire contents of a file "before" writting
> the changes supplied by a textarea. Here is what I have thus far:
[snip]
> As of right now it opens
If you really want to delete the file contents then open the file in
write-only mode, like so:
$open_file = fopen("$file_name","w");
-Naintara
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
t]On Behalf Of Jas
Sent: Monday, June 03, 2002 8:37 AM
To: [EMAIL PROTECTED]
On Mon, 2002-06-03 at 11:37, Jas wrote:
> Not sure how I could do this as I could not find a functions on php.net to
> allow me to first delete the entire contents of a file "before" writting the
> changes supplied by a textarea. Here is what I have thus far:
Just fopen a file with the 'w' mode
Try unlink("$file_name") then fopen("$file_name","rw")
unlink() deletes the whole file from the directory.
Hope this helps.
Hugh
- Original Message -
From: "Jas" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, June 03, 2002 8:37 AM
Subject: [PHP] delete file contents before writi
My mistake:
Try unlink() then touch() not fopen().
Hugh
- Original Message -
From: "hugh danaher" <[EMAIL PROTECTED]>
To: "php" <[EMAIL PROTECTED]>
Sent: Monday, June 03, 2002 12:43 PM
Subject: Re: [PHP] delete file contents before writing?
>
6 matches
Mail list logo