Jump to content

Fwrite file extension


Webnerdz

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.

Link to comment
https://forums.phpfreaks.com/topic/9484-fwrite-file-extension/
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.
Link to comment
https://forums.phpfreaks.com/topic/9484-fwrite-file-extension/#findComment-35027
Share on other sites

Archived

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

×
×
  • Create New...

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.