Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDevelopment and...Development and...DNN Platform (o...DNN Platform (o...Add image in guestbookAdd image in guestbook
Previous
 
Next
New Post
1/2/2009 8:57 AM
 

Hi i am using ADefWebserver:s Guestbook, it is grest

 But I have one question, I want my visitors to be able to add an image instead of their name – it’s a Swedish thing..

 

Ive added this in the view.asxc:

<td align="right" style="width: 4px">

                     <asp:FileUpload ID="ImgUpload1" runat="server" />

        <p>

        <asp:Button ID="Button1" runat="server" Text="Upload"

         OnClick="Button1_Click" /></p>

        <p>

        <asp:Label ID="Label1" runat="server"></asp:Label></p>

 

And this in the VB file:

 

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)

            If ImgUpload1.HasFile Then

                Dim targetFolder As String = Server.MapPath("~/DesktopModules/GuestBook/images/")

                Try

                    ImgUpload1.SaveAs(targetFolder & _

                       ImgUpload1.FileName)

                    Label1.Text = "File Name: " & _

                       ImgUpload1.PostedFile.FileName & "<br>" & _

                       "File Size: " & _

                       ImgUpload1.PostedFile.ContentLength & " kb<br>" & _

                       "Content type: " & _

                       ImgUpload1.PostedFile.ContentType

                    Dim Name = ImgUpload1.PostedFile.FileName.ToString()

                Catch ex As Exception

                    Label1.Text = "ERROR: " & ex.Message.ToString()

                End Try

            Else

                Label1.Text = "You have not specified a file."

            End If

        End Sub

 

The image uploads just fine, but how shall I do to add filename in the db?

 

I have tried to alter the insert procedure but it wont work.

Grateful for help

 

 
New Post
1/2/2009 9:35 AM
 

You can find code that shows how to upload pictures in DNN here:

http://dnnsilverlight.adefwebserver.com/Silverlight10/SilverlightAlbum/tabid/58/Default.aspx

it is in C# but you can convert it to VB using this:

http://converter.telerik.com/



Michael Washington
http://ADefWebserver.com
www.ADefHelpDesk.com
A Free Open Source DotNetNuke Help Desk Module
 
New Post
1/2/2009 1:31 PM
 

 Yes, just what i was looking for ,thanks!!

 
Previous
 
Next
HomeHomeDevelopment and...Development and...DNN Platform (o...DNN Platform (o...Add image in guestbookAdd image in guestbook


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out