Linux vs. Windows file upload names
Posted on 2002-03-25
Not sure of the best place to ask this question, but here we go. I have a simple CGI form that allows the user to upload a file, with the basic <input type="file" ... >.
It works fine, I'm able to get the file on my Linux Apache server, no problem.
But here's the problem: If the client was running on a Linux box, the filename arrives in my CGI script as just the base file name:
"/hello/new/world" arrives as just "world". This is fine because that's all I want, the basename.
BUT, if the client was running on a Windows box it arrives as the fully qualified pathname:
This would be OK if I could easily split the path to get the basename, which I could using "\". The problem is that "\n" is interpreted as a newline character on the receiving end in my CGI script, which is written in Python.
Certainly, regardless of the CGI language, someone has crossed this bridge before?!
Any thoughts would be appreciated.