Hello everyone...I have simple app that can query, insert and delete records using MySql as back end database. But I also want to try to load an image and save to database. I copied the following codes for testing..I don't have any error but when calling the function to save the image file no file is saved.
Kindly check the code...
I appreciate any help...
Thanks in advance,
microbox
Kindly check the code...
B4X:
Dim InputStream1 As InputStream
Try
InputStream1 = File.OpenInput("/storage/sdcard0/map", "1.jpg")
ToastMessageShow("File exist!",False)
Catch
ToastMessageShow("OOPs no file exist!",False)
End Try
Dim OutputStream1 As OutputStream
OutputStream1.InitializeToBytesArray(1000)
File.Copy2(InputStream1, OutputStream1)
Dim Buffer() As Byte 'declares an empty array
Buffer = OutputStream1.ToBytesArray
'write the image to the database
Try
ExecuteRemoteQuery("INSERT INTO pictures VALUES('One', Array As Object(Buffer))",MENUS_LIST)
ToastMessageShow("Saving file done",False)
Catch
ToastMessageShow("Not save!",False)
End Try
Thanks in advance,
microbox