I am trying to upload a file using webView from file nodes (e.g. zippyshare.com). The problem is that I cannot use intentions to open the browser or redirect it through the DownloadManager, since it is based on the session / cookie and runs these methods, it redirects the zip file to the original html file for reuse.
I tried:
Uri source = Uri.parse(url); DownloadManager.Request request = new DownloadManager.Request(source); String cookie = CookieManager.getInstance().getCookie(url); request.addRequestHeader("Set-Cookie", cookie); request.addRequestHeader("User-Agent", view.getSettings().getUserAgentString()); request.addRequestHeader("Accept", "text/html, application/xhtml+xml, *" + "/" + "*"); request.addRequestHeader("Accept-Language", "en-US,en;q=0.7,he;q=0.3"); request.addRequestHeader("Referer", url);
and
Bundle bundle = new Bundle(); String cookie = CookieManager.getInstance().getCookie(url); bundle.putString("cookie", cookie); bundle.putString("User-Agent", view.getSettings().getUserAgentString()); Intent intent = new Intent(Intent.ACTION_VIEW ,Uri.parse(url)); intent.putExtra(Browser.EXTRA_HEADERS, bundle); cordova.getActivity().startActivity(intent);
to try and save the cookie, and although I see that the headers are sent just fine, it still redirects to the html link, which leads me to believe that this is based on the session.
Is there a way to upload a file this way?
source share