How to rename the file which is uploaded from the web form

I have a doctype which has a web form, it has a field of type Attach Image. Now I want to change the name of the file when it is uploaded. how can i do it?