[Date Prev][Date Next][Thread Prev][Thread Next][Interchange by date
][Interchange by thread
]
Re: [ic] s/Reg Exps on file paths/headaches/g ;
On Tue, Mar 13, 2001 at 09:50:25AM -0500, Jason Kohles wrote:
> On Tue, Mar 13, 2001 at 09:44:41AM -0500, office.standardprinting.net wrote:
> > I'm working on an upload page, and found the docs on using [value-extended],
> > etc. So far, so good.
> >
> > But the <input type="file" . . . > tag returns a full path from Win clients,
> > e.g.: F:\folder\file.jpg (Macs dutifully return only the filename, not the
> > whole path :)
> >
> > $filename =~ s|.*[\\]{1}|| ;
> >
> All you really need here is:
>
> $filename =~ s|.*\\||;
>
> to get rid of everything up to and including the last backslash. You might
> want to include forward slashes as well, as most unix browsers also return
> the full path. This should do the trick:
>
> $filename =~ s|.*[\\/]||;
We rename anything uploaded and provide the pathname as supplied as
an informational field. In that case we want the full local pathname.
With the new character sets and all the various ways path delimiters
can be represented that seemed safest to us. That regexp won't
get .2fetc.2fpasswd or (more likely) anything in .2fsession.2f....
>
> --
> Jason S Kohles
> jason@jasonkohles.com
>
> _______________________________________________
> Interchange-users mailing list
> Interchange-users@lists.akopia.com
> http://lists.akopia.com/mailman/listinfo/interchange-users
--
Christopher F. Miller, Publisher cfm@maine.com
MaineStreet Communications, Inc 208 Portland Road, Gray, ME 04039
1.207.657.5078 http://www.maine.com/
Content management, electronic commerce, internet integration, Debian linux
_______________________________________________
Interchange-users mailing list
Interchange-users@lists.akopia.com
http://lists.akopia.com/mailman/listinfo/interchange-users