zeebinz / rarinfo

Simple PHP scripts for inspecting RAR archives and associated files.
29 stars 9 forks source link

Splitting the filename from the path #1

Closed ghost closed 11 years ago

ghost commented 11 years ago

I am just starting to use this and I am getting a consistent error. It appears that if the archive was created in windows and the string path contains "\" then the filename is the full string.

This does not happen when the string path contains "/".

I have looked at rarinfo.php but do not see where I might make a change.

Thank you

zeebinz commented 11 years ago

To summarize the discussion we've had elsewhere: relative paths are always part of the filename in RAR archives if they contain directories, and if you want to strip out the dirnames for a particular reason, it's better to do this within your application:

$filename = pathinfo($file['name'], PATHINFO_BASENAME);

Remember, though, to use the full path for methods that require a filename, as that's how they're identified internally.

ghost commented 11 years ago

Thank you