如何上传图片(Android手机到网络服务器) [英] how to upload image (Android phone to web server)
问题描述
朋友我的项目有问题。我希望在这里得到你的帮助。
我的问题是,
i需要在我的Android手机上传图片到我的使用web services.im的web服务器使用ksoap方法。在我的项目中,我可以注册用户,登录用户
但是现在我需要将android移动图像上传到web服务器。
i ll put用户注册码------------------------------------ ------------------
RegisterActivity.java
Friends i have a problem in my project.i hope to get your help here.
my problem is,
i need to upload image in my android mobile to my web server using web services.im using ksoap method.in my project , i can register user ,login user
but now i need to upload android mobile images to web server.
i ll put user registration code ------------------------------------------------------
RegisterActivity.java
public void onClick(View arg0) {
EditText pasword = (EditText) findViewById(R.id.txtpasswordReg);
EditText confpasword = (EditText) findViewById(R.id.txtConfPassw);
if (pasword.getText().toString().equals(confpasword.getText().toString())) {
SoapServiceProvider service = new SoapServiceProvider();
service.SetUrl_nameSpace("http://tempuri.org/",
"http://192.168.43.47/leaf/PLRSUVWebService.asmx");
EditText txtName = (EditText) findViewById(R.id.txtName);
EditText txtEmail = (EditText) findViewById(R.id.txtEmailAddress1);
Object result = service.getService(new String[][] {
{ "Name", txtName.getText().toString() },
{ "Email", txtEmail.getText().toString() },
{ "Password", pasword.getText().toString() } },
"userRegistartion");
if (result.toString().equals("True"))
{
Toast.makeText(RegisterActivity.this, "Registartion Sucessfully", Toast.LENGTH_SHORT).show();
}
else
Toast.makeText(RegisterActivity.this, "Error Occure", Toast.LENGTH_SHORT).show();
}
else
Toast.makeText(RegisterActivity.this, "Password not matching", Toast.LENGTH_SHORT).show();
}
------------------------------ -------------------------------------------------- -----------
PLRSUVWebService.cs
-------------------------------------------------------------------------------------------
PLRSUVWebService.cs
[WebMethod]
public string userRegistartion(string Name, string Email, string Password)
{
string sql = "INSERT INTO Persons (Name, Email, PassWord, IMEI,state) ";
sql += " VALUES ('" + Name + "', '" + Email + "', '" + Password + "', '','2')";
dbAccess db = new dbAccess();
return db.UPDATE(sql).ToString();
}
}
--------------------- -------------------------------------------------- -------------
i这样做了。现在我需要上传图像,就像我注册用户一样。
这是我需要上传该图像的文件夹路径
C:\ Users \ Thhilan \Desktop\test\ourWebSite \mobile \
你能给我一个很好的解决方案吗?
如果你有一些不清楚的地方请问我。
------------------------------------------------------------------------------------
i did that way.so now i need to upload the image also same way that i register users.
this is the folder path i need to upload that image
C:\Users\Thilan\Desktop\test\ourWebSite\mobile\
can u guys give me a good solution for this?
if u have some unclear places please ask me.
推荐答案
我认为这些文章将指导您正确的方向:
Android:图片上传活动 [ ^ ]
上传图像机器人 [ ^ ]
将图像上传到网络服务器 - Android / Java [ ^ ]
I think these articles will guide you in right direction:
Android: Image upload activity[^]
Uploading Image In Android[^]
Uploading an image to a webserver – Android/Java[^]
这篇关于如何上传图片(Android手机到网络服务器)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!