Re: strtr question
| From: | Mike Morton | Date: | Wed, 28 May 2003 15:12:56 +0000 |
| Subject: | Re: strtr question | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-149265@lists.php.net to get a copy of this message | ||
Ed:
Better yet, because not all browsers pass through the original file name
that was was uploaded, have the user input the name - and validate that
instead. You can then restrict them to numbers letters:
$filename=ereg_replace("[^0-9a-zA-Z.]","",$filename)
Or something like that.
On 5/28/03 10:42 AM, "ed@homes2see.com" <ed@homes2see.com> wrote:
>
> I want to remove unwanted characters from filenames of files uploaded to
> our server. I am currently using strtr to do this. I have a few characters
> that are being removed but I would also like a single quote to be removed
> if it is in the filename. I think it has to be escaped in the command
> though. How do I do this?
>
> TIA,
>
> Ed
>
>
--
Cheers
Mike Morton
****************************************************
*
* Tel: 905-465-1263
* Email: mike@webtraxx.com
*
****************************************************
"Indeed, it would not be an exaggeration to describe the history of the
computer industry for the past decade as a massive effort to keep up with
Apple."
- Byte Magazine
Given infinite time, 100 monkeys could type out the complete works of
Shakespeare. Win 98 source code? Eight monkeys, five minutes.
-- NullGrey