Upload files to a server with ASP script ....
We often require users to upload files to a directory on a web server but without giving them FTP access.
We may for instance, have a personal database, and we need to upload photographs. Or we may have a news page where we would like users to upload pictures.
With such a system it is important to restrict the type of files which can be uploaded as we would not want users to upload executables and then try to run them.
Also, we may wish to identify the maximum file size a user can upload, as sometimes inexperienced people may attempt to upload jpg images which have not been optimized for the web.
These ASP files provide a method to upload files without using a dll component and to configure various features.
There are a number of configuration entries which need to be modified in the 'config.asp' file. You may define file types which are to be excluded, file types which are to be included, the maximum file size which can be uploaded, and the location where the files are to be uploaded. You must also ensure that the directory has the correct permissions to allow saving of files i.e. read and write access on the directory.
Once you have set the configuration options in config.asp, and placed all the files onto your web server, load the page uploadform.asp into your browser.
The upload function itself is in the files uploadfile.asp and upload.asp and my code illustrates how they may be used.
| Copyright © 2007 | Page updated July 2007 |