Cleaned up code a bit
Added a urlencode for the link to match the filename being sent