You need to learn a server-side scripting language which can do this
PHP, .NET, coldfusion, JSP, ASP to mention just a couple
You can also look for some free upload gallery scripts. Maybe you might strike gold although learning is a better path to take