Showing posts with label Fileupload Control. Show all posts
Showing posts with label Fileupload Control. Show all posts

Sunday, June 25, 2017

Asp.net : Check uploaded image is Grayscale or not

In this article I am going to explain how to check uploaded image is Grayscale or not in asp.net.


Description:
Some of application form only accept Grayscale or black & white scanned photograph and signature. In this example I am going to check image size, dimensions and color.

Implementation:

Thursday, June 22, 2017

Check dimensions and size of image before uploading in asp.net

In this article I am going to explain how to check height and width (dimensions) and size of image before uploading in asp.net


Description:
I want to upload the image which have dimensions less than 100 x 120 and size 20 KB. Firstly I have check the image size with height and width, if image size and dimensions is less than the require dimensions then it will be uploaded.

Sunday, June 21, 2015

Add image (logo) watermark to images dynamically while uploading in asp.net

Introduction: In this article I will explain how we can add the watermark of logo to images while uploading in asp.net (C#, VB)
Add image (logo) watermark to images dynamically while uploading in asp.net

Description:
To implement this functionality to project/website add a webform. Create a folder images in project/website to store the uploaded images. Now copy the logo of website and keep/paste it in images folder also. Drag and drop the fileupload control from toolbox to aspx page.

Friday, June 19, 2015

Add watermark text to images dynamically while uploading in asp.net

Introduction: In this article I will explain how we can add the watermark text to images dynamically while uploading in asp.net (C#, VB)

Description:
To implement this functionality to project/website add a webform. Create a folder images in project/website to store the uploaded images. Drag and drop the fileupload control from toolbox to aspx page.

Monday, June 1, 2015

Change the by default text of browse button of Fileupload

Introduction: In this article I will explain how to change the by default text of of browse button of fileupload control in asp.net or input

Description:
When we use the fileupload control or input, commonly see a text Choose File, No file chosen on browser. We can change the by default text of browse button of fileupload control or input type file. In this example I will change the text Choose File to Change Picture using CSS. To implement follow the below given steps:

Thursday, March 12, 2015

Upload multiple files and save their path to database using Fileupload control in asp.net

Sunday, March 8, 2015

Upload multiple files using Fileupload control in asp.net

Introduction: In this article I will explain how to upload multiple files using Fileupload control in asp.net 4.5

Description:

In earlier version of Asp.net (4.0), there is no option to upload multiple files using fileupload control but now Fileupload control support the multiple files selection features and upload all the selected files at once.

Html Markup Of page:
<table>
            <tr><td>Upload Image:</td><td> <asp:fileupload ID="Fileupload1" runat="server" AllowMultiple="true"></asp:fileupload></td></tr>
            <tr><td></td><td><asp:Button ID="Button1" runat="server" Text="Upload File" OnClick="Button1_Click" /></td></tr>
        </table>

Friday, August 8, 2014

Upload and crop image in Asp.net using Jcrop jquery plugin

Introduction: In this article today I am going to explain how we can implement the functionality of Upload and crop image in Asp.net using Jcrop jquery plugin. 

Upload and crop image in Asp.net using Jcrop jquery plugin


Description:

Add a new webform to project. To implement this functionality follow the given steps:

Thursday, July 31, 2014

Preview image before upload using Jquery and save in asp.net

Introduction: In this article today I will explain how we can preview the image before upload and save in asp.net

Description:


Add a webform to project. After add the below given script and style to head section of page:

<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.2.js"></script>
    <script type="text/javascript">
$(function() {
    $("#FileUpload1").on("change", function ()
    {
        var files = !!this.files ? this.files : [];
        if (!files.length || !window.FileReader) return;

        if (/^image/.test( files[0].type)){ 
            var reader = new FileReader(); 
            reader.readAsDataURL(files[0]); 

            reader.onloadend = function(){ 
                $("#imagePreview").css("background-image", "url(" + this.result + ")");
 
            }
        }
    });
});
</script>

Monday, July 28, 2014

Image preview after upload in asp.net

Introduction: In this article today I will explain how we can preview the image after uploading in asp.net.

Description:


Add a webform to project and design the page as shown below:

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <center>
   <fieldset style="width:25%">
   <legend>Uplaod and Preview the Image</legend>
   <table>
   <tr><td>Upload Image:</td><td><asp:FileUpload ID="FileUpload1" runat="server" /><br />
       <asp:Label ID="lblmessage" runat="server"></asp:Label></td></tr>
   <tr><td></td><td> <asp:Button ID="btnupload" runat="server" Text="Upload Image"
           onclick="btnupload_Click" /></td></tr>
   </table>        
       <asp:Image ID="imgpreview" runat="server" width="350px" Height="300px"/>
   </fieldset>

Monday, July 1, 2013

How to Resize image without losing quality in Asp.net

Introduction: In this article I will explain how we can Resizes the image, Validate fileupload control in Asp.net.

Description:
In the previous article I have explained How to Validate theFileupload in Asp.net.
Add a webform to project. Keep the below given script between Head Tag:
<script type="text/javascript">
         function validatefileupload() {
             var arrayExt = ['png', 'PNG', 'jpg', 'JPG', 'JPEG', 'gif', 'GIF', 'jpeg'];
             var FilesVale = document.getElementById("uploadimg");
             var Ext = FilesVale.value.substring(FilesVale.value.lastIndexOf('.') + 1).toLowerCase();
             if (arrayExt.indexOf(Ext) <= -1) {
                 alert("Upload Only png,jpg,gif files");
                 return false;
             }
             else {
                 alert("File Upload Successfully..")
             }
         }
    </script>

Drag and drop the Fileupload control from Toolbox. Here I create a Folder Upload_Images and its sub folder Thumb and Small to save Resized Images.

Monday, June 3, 2013

How to Validate Fileupload Control in Asp.net using Javascript

Introduction: in this I try to explain how we can validate the Fileupload control using Javascript and save path to Database.
Validate Fileupload Control in Asp.net using Javascript

Description:
I have a created table Name DOWNLOAD_ASSIGNMENT. Here ID is primary key.
ID
int
CLASS
varchar(50)
ASSIGNMENT
varchar(MAX)

Add the Connectionstring in web.config file of website.
<configuration>
       <connectionStrings>
    <add name="con" connectionString="Data Source=SYS-1F78031ED0A;Initial Catalog=TestBlog;Integrated Security=True"/>
       </connectionStrings>
       <system.web>
        <compilation debug="true" targetFramework="4.0" />
    </system.web>
</configuration>

After that add a new webform to project and put the below given script in Head tag of webform.

Saturday, June 1, 2013

How to Validate the Fileupload Control with Validation Control in Asp.net

Introduction: In this I try to explain how we can Validate the Fileupload Control and save file path to Database in Asp.net with Validation control. Here I use the RegularExpressionValidator Control to validate the Fileupload control to upload only images extension.

Validate the Fileupload Control with Validation Control

Description:
I have a created table Name STUDENT_INFO. Here STUDENT_ID is primary key.
STUDENT_ID
int
STUDENT_NAME
varchar(50)
STUDENT_IMAGE
varchar(MAX)

Add the Connectionstring in web.config file of website.
<configuration>
       <connectionStrings>
    <add name="con" connectionString="Data Source=SYS-1F78031ED0A;Initial Catalog=TestBlog;Integrated Security=True"/>
       </connectionStrings>
       <system.web>
        <compilation debug="true" targetFramework="4.0" />
    </system.web>
</configuration>

Monday, May 27, 2013

How to use Fileupload control in Gridview in Asp.net


Introduction: In this post I try to explain how we can use the Fileupload control in Gridview.

Description:
I have created a table LINQ_TABLE