Pure ASP Upload Tutorials
Pure ASP Upload - Upload and update record form
Upload and update record form
In this tutorial we will explain how to upload files and other fields and update those in the database. The files will be saved on the server and their names and the other form fields will be updated 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:
TIP: You might also reuse the form you created for Upload and insert record form tutorial, but delete all server behaviors first.
- Add a Recordset
You will need a recordset that will contain the current record. This record will be updated. Usualy you filter this recordset with a parameter passed in the url.
- Bind your database fields to the form
After you have inserted a recordset, you should bind the recordset fields to the form fields. You can do that by dragging and dropping the fields on top of the form fields.
- 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 Update Record Server Behavior
Choose the Update Record Server Behavior from the Server behaviors palette.
Select your database connection and table where you want to save the data in.
Make sure the recordset you created is chosen in Select Recordset From field.
Assign all the entry fields from the form to the corresponding fields in your database.
Enter a redirect page at After Updating, 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 Upload 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 updated in your database. Don't forget to pass an existing BioId as a parameter.
George Petrov
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. The most popular for its over high-quality Dreamweaver extensions and templates.
George is also the founder of Wappler.io - the most Advanced Web & App Builder