Re: Web friendly file names

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jun 3, 2009 at 1:18 PM, Eddie Drapkin <oorza2k5@xxxxxxxxx> wrote:
> As far as I know it will only bug out when the host filesystem would bug
> out, ie UTF-16 characters tend to explode on my linux setup that I develop
> on, and PHP's file handlign doesn't like them, but then again neither does
> the filesystem.  Stuff like "Some silly name! YAY#####" work fine, on the
> other hand.
>
> On Wed, Jun 3, 2009 at 1:00 PM, Skip Evans <skip@xxxxxxxxxxxxxxxxx> wrote:
>
>> Oh, of course that makes sense, and I suppose the PHP move_uploaded_file()
>> function has no problem with weird and crappy file names?
>>
>> Skip
>>
>> Eddie Drapkin wrote:
>>
>>> Well, erm, no.
>>>
>>> I'd store the filename, etc. as-is in the database, and then link it with
>>> urlencode() and you should be able to serve a file called "A non friendly
>>> name!" site.com/A%20non%20friendly.. <http://site.com/A%20non%20friendly..>..
>>> and a modern webserver should be fine with that, and even most browsers will
>>> allow you to type site.com/A <http://site.com/A> non friendly... without
>>> the url escaped characters and it will url escape them in the request.  The
>>> only issue is that the urlencoded special characters are a lot uglier, which
>>> may or may not be a consideration for you.
>>>
>>> On Wed, Jun 3, 2009 at 12:39 PM, Skip Evans <skip@xxxxxxxxxxxxxxxxx<mailto:
>>> skip@xxxxxxxxxxxxxxxxx>> wrote:
>>>
>>>
>> --
>> ====================================
>> Skip Evans
>> Big Sky Penguin, LLC
>> 503 S Baldwin St, #1
>> Madison WI 53703
>> 608.250.2720
>> http://bigskypenguin.com
>> ------------------------------------
>> Those of you who believe in
>> telekinesis, raise my hand.
>>  -- Kurt Vonnegut
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>


how about just hashing the filename? Store them in a week-year folder
and store a record in the db with the real file name and the hash.
-- 

Bastien

Cat, the other other white meat

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux