如果extis通过post使用java将整个文件夹上载到服务器
我是一个java新手,我需要完成这个应用程序并通过Post将整个文件夹发送到我的服务器 现在代码可以工作了,但我需要检查是否存在特定的文件夹名称和路径,然后使用线程上载功能发送所有文件 参考代码:如果extis通过post使用java将整个文件夹上载到服务器,java,android,Java,Android,我是一个java新手,我需要完成这个应用程序并通过Post将整个文件夹发送到我的服务器 现在代码可以工作了,但我需要检查是否存在特定的文件夹名称和路径,然后使用线程上载功能发送所有文件 参考代码: public class UploadToServer extends Activity { TextView messageText; Button uploadButton; int serverResponseCode = 0; ProgressDialog d
public class UploadToServer extends Activity {
TextView messageText;
Button uploadButton;
int serverResponseCode = 0;
ProgressDialog dialog = null;
String upLoadServerUri = null;
/********** File Path *************/
final String uploadFilePath = "/mnt/sdcard/folder/";
final String uploadFileName = "sample.jpg";
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_upload_to_server);
uploadButton = (Button)findViewById(R.id.uploadButton);
messageText = (TextView)findViewById(R.id.messageText);
messageText.setText("Uploading file path :- " + uploadFilePath + uploadFileName);
/************* Php script path ****************/
upLoadServerUri = "http://www.tutomax.com/uploads/Receiver.php";
uploadButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
dialog = ProgressDialog.show(UploadToServer.this, "", "Uploading file...", true);
new Thread(new Runnable() {
public void run() {
runOnUiThread(new Runnable() {
public void run() {
messageText.setText("uploading started.....");
}
});
uploadFile(uploadFilePath + "" + uploadFileName);
}
}).start();
}
});
}
public int uploadFile(String sourceFileUri) {
。。。。REST代码上传功能如何浏览指定文件夹下的所有文件,然后逐个上传匹配的文件。您发布的代码的哪一部分与您的问题相关?请精简代码;没人想通读所有这些。嗨,Gunr2171,对不起,你说得对,这是很长的一段。谢谢你的建议。赛亚