Android Question No Error but No File Uploaded,use PostMultipart

OliverA

Expert
Licensed User
Longtime User
Are we talking about this?
Sub postgambar
Dim j As HttpJob
Dim img As String = filename
Dim mp As MultipartFileData
mp.Initialize
mp.Dir = File.DirRootExternal & "/Android"
mp.FileName = img
mp.KeyName = "file"
mp.ContentType = "image/jpg"
j.PostMultipart("http://pertanian.tech/uploaddata.php", Null, Array(mp))
Wait For (j) JobDone(j As HttpJob)
If j.Success Then
Log(j.GetString)
If img = j.GetString Then
ToastMessageShow("Imagen Cargada.", False)
Else
ToastMessageShow("Error al cargar Imagen.", False)
End If
End If
j.Release
End Sub
If so, since you say there are no errors, am I correct to assume that ToastMessageShow("Imagen Cargada.", False) is executed after an upload? If so, then you have an issue on the PHP side where 1) it is not saving the image properly, or 2) it is not reporting an error properly (including and invocation error).
Just to make sure, after these lines
B4X:
   mp.Dir = File.DirRootExternal  & "/Android"
   mp.FileName = img
add
B4X:
    Log("Exists: " & File.Exists(mp.Dir, mp.FileName))
and see if the file that you are trying to upload exists.
 
Upvote 0

juniorteacher

Member
Licensed User
Longtime User
and see if the file that you are trying to upload exists.
B4X:
Exists : true

java.io.FileNotFoundException: /storage/emulated/0/Android/201804161819.jpg: open failed: EACCES (Permission denied)

Location File In Internal Memory in Folder Android "Sdcard/Android/****.jpg"
 
Upvote 0
Top