[thelist] get filename before the extension (php)

Peter Loron peterl at standingwave.org
Thu Feb 1 15:04:07 CST 2007

Explode/implode are your friends. However, PHP actually provides a 
function to do exactly this task:



Chris Ditty wrote:
> What I have done in the past is explode the filename at the period.
> The first element is the filename and the second is the extension.
> On 2/1/07, Mark Mckee <lists at soddengecko.com> wrote:
>> Hi all
>> I have been searching around the usual forums to find some info on a
>> small script to get a file name. so far all I have found is how to
>> return the extension of the file. what I am aiming to do is return
>> everything before the extension.
>> the reason for this is I am making a small app that will create text
>> files for a friend who runs xampp locally and would like to add info to
>> text files so he can upload to his host that sadly does not have php
>> support or mysql databases.
>> on the edit page I use a GET request to call up the data of the file so
>> it can be edited and re saved. I have managed to get the file name into
>> the input bar but when saved it would save a file called "test.txt" as
>> "test.txt.txt"
>> obviously this is no good. I do not think my friend would appreciate
>> having to edit the .txt off the end of the file name every time he wants
>> to edit it.
>> this is the only function I have left to complete. does anyone here have
>> any suggestions?
>> Mark...
>> --
>> * * Please support the community that supports you.  * *
>> http://evolt.org/help_support_evolt/
>> For unsubscribe and other options, including the Tip Harvester
>> and archives of thelist go to: http://lists.evolt.org
>> Workers of the Web, evolt !

More information about the thelist mailing list