Forum Moderators: phranque
However, you have to consider this really isn't the root of your problem. What's to stop me from creating a virus and naming it innocent-spreadsheet.xml?
The answer will rely in server-side validation of the actual data. I don't mean check that the extension is /\.xml$/i, a method of opening the file to read the headers and determine if it really is an xml file. I use similar methods with images combined with ImageMagick/Imagic. It doesn't matter what the extension is or even if it has one, it check the file type and if it's not one of my supported ones, error out.
In fact, I just checked - although it doesn't directly support XML, XML is inherently a text file, and and ImageMagick will return a text file type, which is half the battle.
This is a bit of overkill if you don't use Imagemagick for anything else, so you could simply open the XML file and examine the first few lines for the prooer headers and data formats. IF not found, error out.
I just wanted to make it easier for users to find the file needed by blocking/hiding all others.
I found a solution. I came across a jquery/flash uploader script that allows me to limit the file name and extension so only files by a certain name are displayed in the file browser.
Thanks!