在外部服务器上上传图像 [英] uploading image on an external server
问题描述
我能够拍照在我的Android应用程序,我能得到它的路径了。现在点击该图片后,我创建了一个名为点击它应该上传图像作为BLOB对象在线托管的外部数据库时上传图片按钮。
我无法做到这一点。谁能帮我在这。
这是code我正在获取图像的路径上传
字符串文件路径=
Environment.getExternalStorageDirectory()+/ your_image_name.jpeg;
档案文件=新的文件(文件路径);
乌里输出= Uri.fromFile(文件);
意图cameraIntent =新意图(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT,输出);
要上传到服务器的形象,强烈推荐使用Web服务。这与在<一个整洁的例子来说明href=\"http://stackoverflow.com/questions/11643474/uploading-an-image-from-android-to-mysql-database\">this链接。建议你参考以继续你的项目中提供的链接中的步骤。
I am able to take picture in my android application and i am able to get its path too. Now after clicking that picture, i have created a button called "upload image" which when clicked should upload that image as a BLOB object in an external database hosted online.
I am unable to do that. Can anyone help me in this.
This is the code i am taking for getting the path of the image to be uploaded:
String filePath =
Environment.getExternalStorageDirectory() +"/your_image_name.jpeg";
File file = new File(filePath);
Uri output = Uri.fromFile(file);
Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, output);
To upload a image to the server, it is highly recommended to use web services. This is explained with a neat example in the this link . Recommend you to refer the steps provided in the link to proceed working on your project.
这篇关于在外部服务器上上传图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!