【发布时间】:2015-05-10 09:13:43
【问题描述】:
我想将 pdf 或 doc 文件从 android 设备上传到 php。 我在 onActivityResult 方法中得到了 filePath。
Uri selectedFileUri = data.getData();
String path = selectedFileUri.getPath();
我想知道是否有任何方法可以将文件发送到服务器?我通过将图像文件编码为 base64 将图像文件发送到服务器,但我如何上传 pdf 或 doc。
【问题讨论】:
-
这是正常的文件上传操作。您在服务器端使用任何 php 框架吗?检查此链接stackoverflow.com/a/4126746/3843374
-
是的,我在服务器端使用 php。我可以对付它。但我想知道我应该从 android 设备发送什么
-
Iam sending image file to server by encoding it to base64 but how can I upload pdf or doc.。您不必更改任何代码。至少如果您没有使用 Bitmap 或 BitmapFactory 上传该图像文件。文件只是一个文件,因此它始终有效。
标签: android file-upload