Just a guess, but I see that if the dir param is not defined then you are assigning it 'C:/projects/....'. Maybe you need to make the link include file:// since it looks like you are trying to download local files.
Or is this a web application that is going to be used remotely? If so then you shouldn't be using the full path like that. Perhaps you should check your web server's error_log to see if any errors are being produced by this such as 404 not found. Also view the source that is output to the browser and make sure that the links look correct.
Hope that helps