Making restrictions with htaccess IMPORTANT

They have: 1 posts

Joined: Jul 2007

My site was hacked brutally and I just recently began to bring it back to normal. However my upload script doesn't work without 777 permissions, but when it is on 777 permissions my directory's are exploited. I tried 755 but it just doesn't work. So I need to know if it possible to restrict .php, .exe, .js and extra directorys from being added to my 777 permission directorys using just .htaccess . I've done this with my script already but apparently people found a way to upload these harmful files anyway.This is why I really need to know if this is possible, or perhaps how to make an upload script that works with 755 permissions, which I've looked around the web for without hope. If its possible to change the chmod permissions of a certain file type using htaccess please tell me how to do that as well.