Pure ASP.NET Upload Tutorials
Saving the image size in the database
Saving the image size in the database
In this tutorial we will explain how to save the image size in the database.
How to do it
To save the uploaded image size in the database, you need to:
- Start with insert or update record upload
page
Start with an insert or update record page where you have Pure ASP.NET Upload on it. We have created those pages in the Upload and insert record form and Upload and update record form tutorials.
- Add two hidden fields to your form
To save the image size in temporary fields first, you need two hidden fields. Insert those and name them imageWidth and imageHeight for example.
- Open the Pure ASP.NET Upload dialog
Select the Pure ASP.NET Upload dialog by opening the Server Behaviors Panel. Select DMXzone - Pure ASP.NET Upload.
Make sure you've selected Images Only for your allowed extensions.
- Choose the save fields
Go to the Advanced tab of the Pure ASP.NET Upload options. There choose the hidden fields you just created in the Save the Image Properties in Hidden Form Fields section.
- Reapply the Update record
After you apply the Pure ASP.NET Upload extension, it will save the image size in the hidden fields. Now we need to apply the Insert Record server behavior (or Update Record if you are using an updating a page) to also save the hidden fields.
You should assign the hidden fields to the fields in your database.
- Save and done
Save your page then, upload it to your server, and you are done! Go to your website and test it - you should be able to upload images and their size will be saved in the database!
NOTE: This method will work only if you upload a single image! It won't work if you try to upload multiple images at the same time - ie if you have multiple file upload fields in your form.
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