Search code examples
androidfile-uploadserverimage-uploadrecent-file-list

How to select any file from recent and upload it on server?


i wanna upload files on server from android app. so User can pick any file from recent like image, doc or any PDF in android app and will upload on server.

So please tell me how to open that recent activity and select any file and how to upload it on server.

Please help me this very important for me.


Solution

  • you can use */* for open all files as in android.

    Intent intent = new Intent();    
    intent.setType("*/*");
    intent.addCategory(Intent.CATEGORY_OPENABLE);
    intent.setAction(Intent.ACTION_GET_CONTENT);
    startActivityForResult(Intent.createChooser(intent, getString(R.string.perform_action_with)), attachmentChoice);
    

    note:where attachmentChoice is Constant.