Pure ASP Upload - Upload and insert record form
Upload and insert record form
In this tutorial we will explain how to upload files and other fields and save those to a database. The files will be saved on the server and their names and the other form fields will be saved in the database.
How to do it
To make file upload and insert a record, you need to:
- Make your form
You can start with an any page where you have a form on it with one or more entry fields. You need to add a file upload field if you haven't got one yet. To If you haven't done it yet, go through the Simple file upload tutorial. So your form will look like:
- Save the page in your site
After you've completed your form, you should save the page in the site you are currently working on.
- Add Insert Record Server Behavior
Choose the Insert Record Server Behavior from the Server behaviors palette.
Select your database connection and table where you want to save the data in.
Assign all the entry fields from the form to the corresponding fields in your database.
Enter a redirect page at After Inserting, Go To this will be the follow up page.
Click OK to insert the server behavior.
- Add the Pure ASP Upload extension
Select the Pure ASP Upload dialog by choosing it from the Server Behaviors palette.
Choose upload folder, Images only but don't enter a redirect url in the Go To field. This is because you already have a redirect in the Insert Record server behavior.
To read more about uploading images read Allowing only images upload tutorial.
To read more about limiting the image size read Restricting image width and height tutorial
- Save and done
Save your page and upload it to your server, and you are done! Go to your website and test it - you should be able to upload images together with other form fields and all fields should be saved as a new record in your database.
George Petrov is a renowned software writer and developer whose extensive skills brought numerous extensions, articles and knowledge to the DMXzone- the online community for professional Adobe Dreamweaver users. His expertise in countless languages and technologies gives inspiration and teach valuable lessons on his website – DMXzone.com which is most popular for its over high-quality Dreamweaver extensions and templates.