Jump to content

Archived

This topic is now archived and is closed to further replies.

Webnerdz

Fwrite file extension

Recommended Posts

I tired to find this somewhere, but I had no luck.

I am trying to find the php code to write a file then a predefined extension. As in, the user enters a file name and the script creates the file and the predefined extenstion.

Right now I can create the file and contents, but the user enters the entire filename 'filename.ext'. I want them to enter 'filename' and the script create the '.php' part.

Hope that makes sense. Thanks in advance for your help.

Share this post


Link to post
Share on other sites
[!--quoteo(post=372987:date=May 10 2006, 01:31 PM:name=Webnerdz)--][div class=\'quotetop\']QUOTE(Webnerdz @ May 10 2006, 01:31 PM) [snapback]372987[/snapback][/div][div class=\'quotemain\'][!--quotec--]
I tired to find this somewhere, but I had no luck.

I am trying to find the php code to write a file then a predefined extension. As in, the user enters a file name and the script creates the file and the predefined extenstion.

Right now I can create the file and contents, but the user enters the entire filename 'filename.ext'. I want them to enter 'filename' and the script create the '.php' part.

Hope that makes sense. Thanks in advance for your help.
[/quote]

Let's say the name of the variable containing the filename is "file"

[code]$file .= ".ext"[/code]

this adds .ext onto the end if $file.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.