I will proceed to explain everything as detailed as possible.
My system is PHP and I used the Materialize framework. There are 2 forms that require uploading files.
Form 1- Requires uploading a photo (JPG, JPEG, PNG, GIF).
Form 2- Requires uploading a file or photo (PDF, JPG, JPEG, PNG, GIF, DOC, XLS, DOCX, PPT, XLSX).
This is my code:
<div class="row">
<div class="input-field col s12 m12 l12"> <!-- Tamano del input-field Upload-File-->
<div class="file-field input-field">
<div class="btn blue">
<input type="hidden" name="MAX_FILE_SIZE" value="2000000" />
<span>Archivo</span>
<input type="file" name="imagen" id="imagen">
</div>
<div class="file-path-wrapper">
<input class="file-path validate" type="text" placeholder="PDF, JPG, JPEG, PNG, GIF, DOC, XLS, DOCX, PPT, XLSX">
</div>
</div>
</div>
</div>
Regarding android, I have a webview:
WebView webView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
webView = (WebView) findViewById(R.id.wb);
webView.setWebChromeClient(new WebChromeClient());
webView.setWebViewClient(new WebViewClient());
webView.getSettings().setJavaScriptEnabled(true);
webView.loadUrl("http://mi.pagina.com");
}
PROBLEM: When I press to upload the file, nothing happens.
I was reading a lot, and it seems that you have to add a lot of code, but I think it varies in the android version.
For the moment add this the Androidmanifest.xml:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
<uses-permission android:name="android.permission.VIBRATE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
And I tried several codes that appear in this forum, but none of them work for me.
I would appreciate your help.
EDITED:
I tried this code:
- The app starts and everything works perfectly, so I assume that the code works perfectly, but it does not start the FILE, so I think some code is missing but javascript on the server