i am using $post->guid to get the URL of an attached file to my post. the output is something like this: http://example.com/foo/ [where foo is the file name]. now i want to make a URL like http://example.com/wp-content/uploads/foo/ how can i code that?
The GUID field is not a URL and should never be used for that purpose. It's a unique identifier that happens to look like a URL, but it should never be trusted as such.
WordPress has a number of functions for retreiving attachment URLs and files:
wp_get_attachment_image is probably what you're looking for in this case.