Are you wanting to randomly generate a filename or set a filename yourself?
If you are wanting to set the name yourself, you will need to use a widget that will set a string variable that is called when Export Texture 2D called for File Name.
If you want it randomly generated, you can use a method similar to this forum thread: