T
Tore Aursand
I'm not sure that that is so important. I assume that he is using the
basename as the basis of a filename to store the file locally. In that
case, the most important thing is probably that the basename that you
obtain doesn't contain things that are directory separators on the
server's filesystem. Whether or not they are separators on the client's
filesystem is probably of lesser importance.
I guess the OP want to preserve only the filename part of the (eventual)
full path sent from the client.
Thus, one have to know what OS (and maybe browser) the client is using, as
far as I can understand from the OP's post.
Does anyone have - or know of - a list of OS'es and their path separators?
I'm only familiar with '/', '\' and ':'.
With thst in mind, one could try something (...) like this:
if ( $filename =~ m,(.+[/|\\|:])?(.+)$, ) {
$filename = $2;
}
else {
die "'$filename' doesn't seem to be a valid filename!\n";
}