[development] Shortening file names downloaded from webpage

Stewart Robinson stewsnooze at gmail.com
Tue Sep 15 13:49:33 UTC 2009


I believe the problem Nitin had was around long file names and that approach
doesn't guarantee a file name that is within a certain length, where as the
md5 does. I agree that his approach using those two lines is a nicer cleaner
approach if you don't have to worry about file name length.
Stew

2009/9/15 Earnie Boyd <earnie at users.sourceforge.net>

> Quoting nitin gupta <nitingupta.iitg at gmail.com>:
>
>
>> $arr = parse_url($image_url);
>> $filename = basename($arr['path']);
>>
>> This code solves the problem by removing the query and fragments of the
>> url.
>> Does anyone know of any better way to handle this? Can anyone point out
>> any
>> issues with this code?
>>
>
> I think this is the better way.  I don't find anything in the Drupal API to
> help.
>
> --
> Earnie
> -- http://r-feed.com/           -- http://for-my-kids.com/
> -- http://www.4offer.biz/       -- http://give-me-an-offer.com/
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.drupal.org/pipermail/development/attachments/20090915/8a052998/attachment-0001.htm>


More information about the development mailing list