Jump to content

Trimming a filename from it's full path to just it's file name


BarneyJoe

Recommended Posts

I have a form that users use to upload an image, as well as Title field that users can use to default to the file name, or type in one manually.

At the moment there's a button to populate the temp field that gets dumped in the Title field when the record is added.

However, at the moment it just copies in the full text of the file name's path, eg :

c:/images/image.jpg

[code=php:0]
<input name="uploadFile" type="file" size="55">
<input type="hidden" name="MAX_FILE_SIZE" value="25000" /> </td>

<input name="DefautButton" type="button"
onClick="Title.value=uploadFile.value?uploadFile.value:'No file'" value="Default">
           
<input name="Title" type="text" id="Title" size="69">
[/code]

Is it possible to trim it either here (or I suppose in the upload script) so that it just inserts :

image.jpg instead of c:/images/image.jpg ?

Cheers,
Iain

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.