Click here to Skip to main content
12,816,654 members (34,786 online)
Rate this:
Please Sign up or sign in to vote.
See more: C# ASP.NET
while uploading images the path given to store images is not found.
Posted 24-Dec-12 19:50pm
Krunal Rohit 25-Dec-12 0:51am
Provide your code...
hiphopper0123 25-Dec-12 1:14am
if u expect help then provide your code
Oleksandr Kulchytskyi 25-Dec-12 3:39am
Are envisioning to expose any code to community?)

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

You should provide your code and explain more about your problem.
ok, I can guess that you are talking about image path of ASP.NET Client side. you cant find full path of any uploaded document. So you can encode your uploaded image on client side and also can view the image, after postback on button click get the encode (base64) data to binary and save to database or store image on application server.

follow this given code:

<form id="form1" runat="server">
        <asp:Image ID="imgEmployee"  runat="server" ImageUrl="" Width="100px"
                    Height="120px" />

        <script type="text/javascript">
            function handleFileSelect(evt) {

                var fileUpload = document.getElementById('<%=photoUpload.ClientID%>');
                var imgEmployee = document.getElementById('<%=imgEmployee.ClientID%>');

                var files =; // FileList object
                // Loop through the FileList and render image files as thumbnails.
                for (var i = 0, f; f = files[i]; i++) {

                    // Only process image files.
                    if (!f.type.match('image.*')) {
                    var reader = new FileReader();
                    var base64Data;

                    reader.onload = (function (theFile) {
                        return function (e) {
                            // Render thumbnail.
                            var span = document.createElement('span');

                            base64Data =;
                            var fileSize = base64Data.length;
                            var IndexData = base64Data.indexOf('base64,');
                            var fileName = escape(;
                            imgEmployee.src = base64Data;

                    // Read in the image file as a data URL.


<asp:FileUpload runat="server" ID="photoUpload" TabIndex="7"  onchange="handleFileSelect(event)"   />



This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

    Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.170308.1 | Last Updated 25 Dec 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100