I'm trying to upload a file via the webservice and I'm getting the error: "Server was unable to process request. ---> Object reference not set to an instance of an object." The code I'm using is below. Can someone please point me in the right direction? Thanks!
Try
Dim fileName As String = "C:\temp\pup.jpg"
' Open a file that is to be loaded into a byte array
Dim oFile As System.IO.FileInfo
oFile = New System.IO.FileInfo(fileName)
Dim oFileStream As System.IO.FileStream = oFile.OpenRead()
Dim lBytes As Long = oFileStream.Length
If (lBytes > 0) Then
Dim fileData(lBytes - 1) As Byte
' Read the file into a byte array
oFileStream.Read(fileData, 0, lBytes)
oFileStream.Close()
Dim lc As New LoginCredentials()
lc.PortalId = 0
lc.Username = "user"
lc.Password = "password"
Dim ssc As New DMXService()
ssc.LoginCredentialsValue = lc
If ssc.Login() Then
ssc.SimpleUploadNewEntry(0, fileData, "pup.jpg")
End If
End If
Catch ex As Exception
Response.Write(ex.Message)
End Try