Hi all
I have an application for electronic exams, the user has to create an excel file on his computer, copy the file to his phone, and then upload it through the application. Below is the code I used, and it did not succeed in uploading the file.
Maybe the problem was with the permission to access the storage.
What is wrong with the code?
Secondly, I want to know, is this the best way? And if there is another way that bypasses asking the user for permission to access the storage (other than sending via email).
I have an application for electronic exams, the user has to create an excel file on his computer, copy the file to his phone, and then upload it through the application. Below is the code I used, and it did not succeed in uploading the file.
B4X:
cc.Show("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "اختر ملف")
Wait For cc_Result (Success As Boolean, Dir As String, FileName As String)
Dim xui As XUI
If Success=True Then
Dim in As InputStream
in = File.OpenInput(Dir, FileName)
Dim out As OutputStream
out = File.OpenOutput(xui.DefaultFolder, "uploaded_file.xlsx", False)
File.Copy2(in, out)
in.Close
out.Close
Up.doFileUpload(Null,Null,xui.DefaultFolder & "/uploaded_file.xlsx","https://mywebsite.com/Delta/upload_file.php")
End If
Maybe the problem was with the permission to access the storage.
What is wrong with the code?
Secondly, I want to know, is this the best way? And if there is another way that bypasses asking the user for permission to access the storage (other than sending via email).