e 7 years ago
parent 75421b92c4
commit 9ae1d8b530
  1. 2
      Aria/src/main/java/com/arialyy/aria/core/upload/uploader/HttpThreadTask.java
  2. 8
      Aria/src/main/java/com/arialyy/aria/core/upload/uploader/SimpleUploadUtil.java
  3. 4
      app/src/main/java/com/arialyy/simple/upload/HttpUploadActivity.java

@ -90,7 +90,7 @@ class HttpThreadTask extends AbsThreadTask<UploadEntity, UploadTaskEntity> {
}
uploadFile(writer, mTaskEntity.attachment, uploadFile);
finish(writer);
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
fail();
}

@ -17,6 +17,7 @@ package com.arialyy.aria.core.upload.uploader;
import com.arialyy.aria.core.common.IUtil;
import com.arialyy.aria.core.common.OnFileInfoCallback;
import com.arialyy.aria.core.inf.AbsTaskEntity;
import com.arialyy.aria.core.inf.IUploadListener;
import com.arialyy.aria.core.upload.UploadEntity;
import com.arialyy.aria.core.upload.UploadTaskEntity;
@ -47,6 +48,8 @@ public class SimpleUploadUtil implements IUtil, Runnable {
@Override public void run() {
mListener.onPre();
switch (mTaskEntity.requestType) {
case AbsTaskEntity.U_FTP:
new FtpFileInfoThread(mTaskEntity, new OnFileInfoCallback() {
@Override public void onComplete(String url, int code) {
if (code == FtpFileInfoThread.CODE_COMPLETE) {
@ -60,6 +63,11 @@ public class SimpleUploadUtil implements IUtil, Runnable {
mListener.onFail(needRetry);
}
}).start();
break;
case AbsTaskEntity.U_HTTP:
mUploader.start();
break;
}
}
@Override public long getFileSize() {

@ -35,7 +35,7 @@ public class HttpUploadActivity extends BaseActivity<ActivityUploadBinding> {
private static final String TAG = "HttpUploadActivity";
@Bind(R.id.pb) HorizontalProgressBarWithNumber mPb;
private static final String FILE_PATH = "/sdcard/large.rar";
private static final String FILE_PATH = "/mnt/sdcard/gg.zip";
@Override protected int setLayoutId() {
return R.layout.activity_upload;
@ -50,7 +50,7 @@ public class HttpUploadActivity extends BaseActivity<ActivityUploadBinding> {
@OnClick(R.id.upload) void upload() {
Aria.upload(HttpUploadActivity.this)
.load(FILE_PATH)
.setUploadUrl("http://172.18.104.66:8080/upload/sign_file")
.setUploadUrl("http://127.0.0.1:8080/upload/")
.setAttachment("file")
.start();
}

Loading…
Cancel
Save