file upload function nearly finish

digest the whole logic and code of the file upload and make my own
requirement of file upload