When you're logged in via FTP, you are logged in under your own user ID.
The Web server does not run under your user ID. Typically the Web server runs as a special user (often "nobody" or "httpd") with read access, not write access, to the htdocs filespace.