B4J Question httpjob PostFile (Error : No File Found to Upload)

qey

Member
Hi everyone, i encountered this problem where i want to upload the .xlsx file. when i log the error message it said No File Found to Upload eventhough the filename already selected. Any suggestion and advice will be appreciated. Thank You !

B4X:
Private Sub btnUploadExcel_Click
    fc.Initialize
    fc.InitialDirectory = FindUserDocumentsFolder
    fc.SetExtensionFilter("EXCEL",Array("*.xlsx","*.xls"))
    fc.Title = "SELECT EXCEL"
    Dim fileName As String = fc.ShowOpen(B4XPages.GetNativeParent(Me))
    If fileName <> "" Then
    Dim jobVerif As HttpJob
        jobVerif.Initialize("", Me)
        jobVerif.PostFile(url,"",fileName)
        jobVerif.GetRequest.SetContentType("application/form-data")
        Wait For (jobVerif) JobDone(Job As HttpJob)
        Log("Error: " & Job.ErrorMessage)
    '    Log(Job.GetString)
        If jobVerif.Success Then
            Dim parser As JSONParser
            parser.Initialize(Job.GetString)
            Dim rRoot As List = parser.NextArray
                ....
        End If
    End If
End Sub
 
Top