On Tue, 2010-01-05 at 12:39 +0000, Ingleby, Les wrote:

> Hi all, first time I have posted here so please be nice.
> 
> I am using PEAR HTTP_Upload to handle multiple file uploads. What I need to 
> do is to take the file name which is output using the getProp() function and 
> then remove the file extension from the end of the file for example:
> 
> Original name held in the getProp() array [name] "word_doccument.docx"
> 
> I need to put this into a string such as
> 
> $filename = $props['name'];
> 
> I then need to separate the file name from the file extension.
> 
> I have been reading the php manual do please don't bother referring me to 
> that.
> 
> Thanks in advance.
> 
> LEGAL INFORMATION
> Information contained in this e-mail may be subject to public disclosure 
> under the Freedom of Information Act 2000. Unless the information is legally 
> exempt, the confidentiality of this e-mail and your reply cannot be 
> guaranteed. 
> Unless expressly stated otherwise, the information contained in this e-mail & 
> any files transmitted with it are intended for the recipient only. If you are 
> not the intended recipient you must not copy, distribute, or take any action 
> or reliance upon it. If you have received this e-mail in error, you should 
> notify the sender immediately and delete this email. Any unauthorised 
> disclosure of the information contained in this e-mail is strictly 
> prohibited.  Any views or opinions presented are solely those of the author 
> and do not necessarily represent those of Tyne Metropolitan College unless 
> explicitly stated otherwise.
> This e-mail and attachments have been scanned for viruses prior to leaving 
> Tyne Metropolitan College. Tyne Metropolitan College will not be liable for 
> any losses as a result of any viruses being passed on.


PHPBB uses the substr() function along with the strrpos() function to
grab the extension from a file. You could do something like this:
(untested - I always forget the order of the params!)

$name = substr($filename, 0, strrpos($filename, '.'));

Thanks,
Ash
http://www.ashleysheridan.co.uk


Reply via email to