TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Dharmchand Dhingra
NA
16
0
Image not uploading
Dec 13 2009 1:04 PM
Hi,
I am developing a vb.net application in which i uploading some paramenters which is given below "FirstName,MiddleName,LastName,MyImage".
Uploading is done successfully but image is not showing at webpage. It is uploading FirstName, MiddleName, LastName not Myimage.
My Code is below:
myUri = New Uri("https://www.mysite.com/apis/CreateMyContact.cfm")
data = data.Append("&FirstName=" & System.Web.HttpUtility.UrlEncode(Dharm))
data = data.Append("&MiddleName=" & System.Web.HttpUtility.UrlEncode(Chand))
data = data.Append("&LastName=" & System.Web.HttpUtility.UrlEncode(Dhingra))
data = data.Append("&NickName=" & System.Web.HttpUtility.UrlEncode(Dharmu))
Dim fs As System.IO.FileStream = Nothing
Dim imgByte() As Byte = Nothing
Try
fs = System.IO.File.Open(image_path, IO.FileMode.Open, FileAccess.Read)
ReDim imgByte(fs.Length)
fs.Read(imgByte, 0, fs.Length)
fs.Close()
fs.Dispose()
fs = Nothing
Catch ex As System.Exception
End Try
If Not IsNothing(imgByte) Then
data = data.Append("&PhotoBinary=" & System.Web.HttpUtility.UrlEncode(imgByte)) 'image_path)) '
End If
'Create a byte array of the data we want to send
Dim requestBytes As Byte() = System.Text.UTF8Encoding.UTF8.GetBytes(data.ToString())
Dim oWeb As New System.Net.WebClient()
oWeb.Headers.Add("Content-Type", "application/x-www-form-urlencoded")
Try
Dim bytRetData As Byte() = oWeb.UploadData(myUri, "POST", requestBytes)
Catch ex As WebException
End Try
This code is working successfully but image is not uploading.
Please guide me if i did wrong something in code.
Regards
Dharmchand dhingra
Reply
Answers (
4
)
how can i move the user control? (runtime)
Inheritance