in reply to uploaded file is not proper

You forgot:
  1. to open $fname for reading
  2. the <code>-tags ;-)