[Zope] Cleaning Filenames from Windows
Dylan Reinhardt
zope at dylanreinhardt.com
Fri Sep 19 18:35:40 EDT 2003
On Fri, 2003-09-19 at 15:03, Edward Pollard wrote:
> I have a form with which one can upload images.
>
> However, Internet Explorer for PC is a very clever program, and instead
> of putting the filename in the 'filename' attribute of the request
> object, it puts the whole local path of the file. This of course is
> unsuitable for a filename on the server.
And for any remaining IE6 users who may happen to value their privacy.
>
> However, due the the escape nature of the backslash, I'm having a
> tremendous problem writing a function to clean up this mess. I am
> certain I used to have a code snippit to do this, but cannot find it.
I assume you want a regex that captures everything after the final
backslash?
How about (untested):
'.*\\([\w|\d]+)'
HTH,
Dylan
More information about the Zope
mailing list