如何将PDF文件上传到Android中的服务器?
问题描述:
我提到了一些以前的问题,但没有得到适当的解决方案.我正在创建一个应用程序,并希望通过从文件管理器中选择PDF文件来发送它.
I referred some previously asked questions but not get proper solution.I am creating an Application and want to send PDF file by selecting it from File Manager.
感谢任何帮助.
答
仅当必须从图库中选择PDF文件时,才需要更改此代码行. intent.setType("application/pdf") 这只会搜索图库中的PDF文件.
Only you have to change this lines of code when you have to select PDF file from gallery . intent.setType("application/pdf") this will search only PDF files from gallery.
Intent intent = new Intent();
intent.setType("application/pdf");
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(Intent.createChooser(intent, "Select Pdf"), PDF);