Forum Moderators: coopster

Message Too Old, No Replies

removing extensions form a filename

         

kumarsena

10:11 pm on Oct 12, 2004 (gmt 0)

10+ Year Member



heys guys,

i need a way to remove teh .txt extension from a filename and possibly replace it with .cnt or something.

its for a comment system that takes the article file name and then opens the corresponding comment file and then prints the stuff.

any sugesstions to the whole script also apreciated,

tnx
k

jatar_k

10:18 pm on Oct 12, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



open file
grab content
close file
open new file pointer
write data
close file
delete old file

seems straight forward enough

fopen()
file_get_contents() or file() or fread()
fclose()
fopen()
fwrite()
fclose()
unlink()

kumarsena

10:19 pm on Oct 12, 2004 (gmt 0)

10+ Year Member



i thought of ereg_replace

any other sugestions?

k

kumarsena

11:20 pm on Oct 12, 2004 (gmt 0)

10+ Year Member



just what i had in mind, but need to check out the unlink fucntion though.

tnx
k

SofterLogic UK

11:43 am on Oct 13, 2004 (gmt 0)

10+ Year Member



How about just include() it?