1
嗨,大家好,我点击按钮rent
时,如何将图片上传到我的网络主机上的文件管理器?截至目前,我不会从任何事情开始,因为我试图以我从图库上传的方式上传它,但它没有奏效。你能帮助我吗?截至目前我打扫我的代码,这是它
@Override
public void onClick(View v) {
HashMap postData = new HashMap();
postData.put("txtCarModel", tvCarModel.getText().toString());
postData.put("txtCarType", tvCarType.getText().toString());
postData.put("txtCapacity", tvCapacity.getText().toString());
postData.put("txtPlateNumber", tvPlateNumber.getText().toString());
postData.put("image", toString());
postData.put("txtFuelType", tvFuelType.getText().toString());
postData.put("txtOwner", tvPoster.getText().toString());
if (TextUtils.isEmpty(etResDate.getText().toString())) {
Toast.makeText(this, "Insert reservation date.", Toast.LENGTH_SHORT).show();
return;
}
postData.put("txtResDate", etResDate.getText().toString());
if (TextUtils.isEmpty(etResTime.getText().toString())) {
Toast.makeText(this, "Insert reservation time.", Toast.LENGTH_SHORT).show();
return;
}
postData.put("txtResTime", etResTime.getText().toString());
if (TextUtils.isEmpty(etResLocation.getText().toString())) {
Toast.makeText(this, "Insert pickup location.", Toast.LENGTH_SHORT).show();
return;
}
postData.put("txtResLocation", etResLocation.getText().toString());
postData.put("txtRenter", pref.getString("username","").toString());
PostResponseAsyncTask taskPost = new PostResponseAsyncTask(DetailActivity.this, postData, new AsyncResponse() {
@Override
public void processFinish(String s) {
if (s.contains("New records created successfully")) {
Log.d(TAG, s);
Toast.makeText(DetailActivity.this, "Wait for owners approval", Toast.LENGTH_SHORT).show();
Intent in = new Intent(DetailActivity.this, RenterTabs.class);
startActivity(in);
finish();
} else {
Toast.makeText(getApplicationContext(), "Error", Toast.LENGTH_SHORT).show();
}
}
});
taskPost.execute("http://carkila.esy.es/rent.php");
}
嗨,先生,对不起,我迟到了,我一直在学校。此代码是否可用于上传'http:// carkila.esy.es/uploadRent/id.jpg'?谢谢先生 –