I want to upload image from my B4A APP to IIS server over the internet or wifi.
I using code below:-
Private link As String = "https:\\web.abc.com.my\abcweb\Temp" =>This is IIS server setting
Private cc As ContentChooser
Sub btnSendFile_Click
cc.Show("*/*", "Choose file")
End Sub
Sub cc_Result (Success As Boolean, Dir As String, FileName As String)
If Success Then
Dim j As HttpJob
Dim out As OutputStream
out.InitializeToBytesArray(0)
Dim In As InputStream = File.OpenInput(Dir, FileName)
File.Copy2(In, out)
Dim lastSlash As Int = FileName.LastIndexOf("/")
If lastSlash > -1 Then
FileName = FileName.SubString(lastSlash + 1)
End If
Dim su As StringUtils
Dim j As HttpJob
j.Initialize("file", Me)
j.PostBytes(link & "?type=file&name=" & su.EncodeUrl(FileName, "UTF8"), _
out.ToBytesArray)
End If
End Sub
I obtain the following error with file attach.
Any suggestion to fix this problem?
Thanks a Lot to everyone.
Best regards.
I using code below:-
Private link As String = "https:\\web.abc.com.my\abcweb\Temp" =>This is IIS server setting
Private cc As ContentChooser
Sub btnSendFile_Click
cc.Show("*/*", "Choose file")
End Sub
Sub cc_Result (Success As Boolean, Dir As String, FileName As String)
If Success Then
Dim j As HttpJob
Dim out As OutputStream
out.InitializeToBytesArray(0)
Dim In As InputStream = File.OpenInput(Dir, FileName)
File.Copy2(In, out)
Dim lastSlash As Int = FileName.LastIndexOf("/")
If lastSlash > -1 Then
FileName = FileName.SubString(lastSlash + 1)
End If
Dim su As StringUtils
Dim j As HttpJob
j.Initialize("file", Me)
j.PostBytes(link & "?type=file&name=" & su.EncodeUrl(FileName, "UTF8"), _
out.ToBytesArray)
End If
End Sub
I obtain the following error with file attach.
Any suggestion to fix this problem?
Thanks a Lot to everyone.
Best regards.