I want to get a file from my SD CARD to the mobile web browser(chrome). I have the fixed path for it for ex sd/ECG/12345.pdf
and I want to do it from the browser itself without selecting the path every time and just click a button which goes to that path every time automatically and show the file. How to do it?
Asked
Active
Viewed 1,101 times
4

frogatto
- 28,539
- 11
- 83
- 129

pankaj malik
- 107
- 2
- 15
-
If you want this in web app then you can't, you can only add a way for the person to pick the file using input type file or using drag and drop. – jcubic May 13 '16 at 12:06
2 Answers
1
Try this URL in browser
file://sdcard/ECG/12345.pdf
I'm not sure it's allowed in Android, but you can try this in click event,
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.addCategory(Intent.CATEGORY_BROWSABLE);
intent.setDataAndType(Uri.parse("file:///sdcard/ECG/12345.pdf"), "application/pdf");
startActivity(intent);
-
Can you please explain we are not able to understand as we are trying to pick file from sd card without selecting link every-time and just click a button which automatically goes to that part and pick that file. – pankaj malik May 13 '16 at 12:12
-
@pankajmalik I'm not sure what you intend to do opening this url on browser should open the file in browser in most devices.. – NuttLoose May 13 '16 at 12:33
-
If you are building an app, launch this url using Intent on button click event http://stackoverflow.com/questions/23240469/open-online-pdf-file-through-android-intent – NuttLoose May 13 '16 at 12:35
-
as I cleared in my question i have a third party native app, and when i click on a link on my website from my browser it opens that native application and saves a PDF file in sdcard/ECG/Folder/12345.pdf . i want to open this PDF in my website my by clicking a link by giving this path "sdcard/ECG/Folder/12345.pdf" – pankaj malik May 16 '16 at 05:37
-
@pankajmalik Got it. In that case I'm not sure android allows third party apps to access too SD storage, but you can try the updated answer – NuttLoose May 16 '16 at 05:56
1
First, on Android 4.4+, no app has arbitrary access to removable storage. This should include Chrome.
Second, your path will be wrong on most devices. The actual path to removable storage varies by device and manufacturer.

CommonsWare
- 986,068
- 189
- 2,389
- 2,491
-
as I cleared in my question i have a third party native app, and when i click on a link on my website from my browser it opens that native application and saves a PDF file in sdcard/ECG/Folder/12345.pdf . i want to open this PDF in my website my by clicking a link by giving this path "sdcard/ECG/Folder/12345.pdf – pankaj malik May 16 '16 at 06:10