import System.IO;
var filesList = new Array();
function ReadDirectory() {
var path = Application.dataPath+"\\music\\";
var info = new DirectoryInfo(path);
var fileInfo = info.GetFiles();
for (file in fileInfo)
{
var filename = file.ToString();
filename = filename.Replace(Application.dataPath+"\\music\\", "");
filesList.Push(filename);
}
print(filesList);
}
Here's another example, Desktop game?, showing how to read a file. Note that only standalone executables can read files on the player's machine. The web-browser version can not, for security reasons.
Unity will not automatically expand wildcards for you, like "*.mp3", that is something you need to using .Net directory functions.
Also - the Update() function runs every frame - you probably want to move your file-reading to a function that runs once, called either in Start(), or via button click or something.
On second reading - it's not clear from your question, if you mean to read files on the user's machine, or if you're allowing the user to upload files to your server. Can you clarify what you're asking for?