Uploading Image problem

Add-in Express™ Support Service
That's what is more important than anything else

Uploading Image problem
All Other parameters are uploaded successfully but image is not uploaded 
Dharmchand Dhingra




Posts: 16
Joined: 2009-11-16
Hi,
First of all thanks to all to review out of course question because this is not add-in or vsto problem.

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
Posted 09 Dec, 2009 05:41:28 Top
Andrei Smolin


Add-in Express team


Posts: 18825
Joined: 2006-05-11
Hi Dharmchand,

I'm afraid we cannot answer questions not related to Add-in Express.


Andrei Smolin
Add-in Express Team Leader
Posted 09 Dec, 2009 07:53:48 Top
Dharmchand Dhingra




Posts: 16
Joined: 2009-11-16
Hi Anderi Smolin,

Thanks for reply and i know that this was post was not related to Add-in-Express.


Regards
Dharmchand Dhingra
Posted 09 Dec, 2009 08:34:07 Top