How to upload images in asp.net by using vb.net

Showing Answers 1 - 2 of 2 Answers

Guest

  • Mar 25th, 2006
 

hi laxman

as i got u , you can upload images in asp.net as follows:

i am hereby telling you as that u have image's path stored in the database table

Conn.Open();

SqlCommand cmd=new SqlCommand("select COLUMN from YOURTABLE",Conn);

SqlDataReader reader=cmd.ExecuteReader();

Repeater3.DataSource=reader;

Repeater3.DataBind();

Conn.Close();

now in html view----------------------

 <asp:repeater id="Repeater2" runat="server">
       <ItemTemplate>
        <table>
         <tr>
          <td>
           <asp:Image Height=100px Width=100px ImageURL='<%#Container.DataItem%>' Runat=server>
           </asp:Image></td>
         </tr>
        </table>
        </BR>
       </ItemTemplate>
      </asp:repeater>

try this and happy coding

  Was this answer useful?  Yes

ramkim

  • Apr 5th, 2006
 

To save image to webserver, here is the code

keep enctype="multipart/form-data" attribute in form tag.

Add file type control making it runat server. which will be html runat server control.

on click of button write following code

Dim myFile As HttpPostedFile

myFile = cntrlName.PostedFile

myFile.SaveAs(Server.Mappath("/dirname/new.gif")

You can also check content type using myFile.ContentType

 

 

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions