BarneyJoe Posted December 18, 2006 Share Posted December 18, 2006 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 Link to comment https://forums.phpfreaks.com/topic/31075-trimming-a-filename-from-its-full-path-to-just-its-file-name/ Share on other sites More sharing options...
trq Posted December 18, 2006 Share Posted December 18, 2006 [url=http://php.net/basename]basename[/url]. Link to comment https://forums.phpfreaks.com/topic/31075-trimming-a-filename-from-its-full-path-to-just-its-file-name/#findComment-143472 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.