If you have the GUID of the file, you could do the following:
var attachmentUrl = AttachmentInfoProvider.GetAttachmentUrl(fileGuid, nodeAlias);
fileGuid
would be the GUID of the file, and nodeAlias
would be the alias of the page that the file is uploaded to (this is usually a URL-friendly version of the DocumentName
).
You will get a URL similar to: /getattachment/1c569cc8-c6aa-4b61-862c-62fad15f39f9/MyPage.aspx