It depends what user the website is run under compared to the user you ftp as.
If you ftp as your username and the webserver also runs your site as your username then 644 will work as the webserver is running as your user and hence is the owner of the file and the '6' part (Read & Write) applies to them.
If you ftp as your username and the webserver runs your site as anon or something similar then 644 will not work as the webserver is running as a different user and hence is NOT the owner of the file and the '4' part (Read only) applies to them.
777 will always work as you are basically saying that all users can write to the file so even if the webserver runs your script as anon it can still write.
Different ISPs use different configurations for what user the webserve runs as, e.g. see
http://httpd.apache.org/docs-2.0/suexec.html . If you want to find out, one way (doubtless there are others) is to upload a file and see who the owner is (tells you what user you ftp as) then write a simple php script to create a file, run it via webserver and see who owns that file (tells you what user web server runs as).
HTH,
Dai