Author: adamskiii | Posted on: 10/12/2010 6:31:17 PM | Views : 301

I am using VB to upload image files to my server but am having problems. How can I use the ContentType to filter only image files? This is my code for my upload button which does not seem to be working. I can only upload bmp files:


Protected Sub btnSave_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSave.Click If txtFileUpload.PostedFile.ContentLength = 0 Then lblMessage.Text = "No file to upload" Else 'if the upload does not contain an image...error If txtSaveAs.Text Is Nothing OrElse txtSaveAs.Text.Trim() = "" Then txtSaveAs.Text = txtFileUpload.FileName Else txtSaveAs.Text = txtSaveAs.Text.Trim() End If Try Dim path As String = Server.MapPath("~/images") Dim fileType As String = txtFileUpload.PostedF ...

Go to the complete details ...