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
U