我正在尝试使用以下代码将pdf文件上传到服务器。我正在使用uploadservice library
,它在处理小文件时效果很好。但是,当我上传较大的pdf文件时,这会花费太多时间,并且在完成时会给我“上传期间出错”。我更改了服务器上载和发布值的限制。
我的问题:上传大文件时出现的错误是来自互联网速度还是此库未上传大文件?
if (path == null) {
Toast.makeText(this, "Please move your .pdf file to internal storage and retry", Toast.LENGTH_LONG).show();
} else {
//Uploading code
try {
String uploadId = UUID.randomUUID().toString();
//Creating a multi part request
new MultipartUploadRequest(this, uploadId, myuploaduri)
.addFileToUpload(path, "pdf") //Adding file
.addParameter("name", name) //Adding text parameter to the request
.setNotificationConfig(new UploadNotificationConfig())
.startUpload(); //Starting the upload
} catch (Exception exc) {
Toast.makeText(this, exc.getMessage(), Toast.LENGTH_SHORT).show();
}
}
这是我的日志
07-18 00:15:18.280 13333-13333 / com.salahahmed.zaker D / OpenGLRenderer:prepareDirty(0.00,0.00,720.00,1280.00)不透明1 <0x616b4bd8> 07-18 00:15:18.281 13333-13333 / com.salahahmed.zaker D / OpenGLRenderer:完成<0x616b4bd8> 07-18 00:15:18.726 13333-13333 / com.salahahmed.zaker I / View:着陆调度到android.support.v7.widget.AppCompatButton {41ec73c0 VFED..C。 ........ 0,96-720,192#7f080035 app:id / button_upload},事件= MotionEvent {action = ACTION_DOWN,id [0] = 0,x [0] = 481.33148,y [0] = 80.73535 ,toolType [0] = TOOL_TYPE_FINGER,buttonState = 0,metaState = 0,标志= 0x0,edgeFlags = 0x0,pointerCount = 1,historySize = 0,eventTime = 5759257,downTime = 5759257,deviceId = 2,source = 0x1002} 07-18 00:15:18.737 13333-13333 / com.salahahmed.zaker D / OpenGL渲染器:prepareDirty(0.00,0.00,720.00,1280.00)不透明1 <0x616b4bd8> 07-18 00:15:18.739 13333-13333 / com.salahahmed.zaker D / OpenGLRenderer:完成<0x616b4bd8> 07-18 00:15:18.775 13333-13333 / com.salahahmed.zaker D / OpenGL渲染器:prepareDirty(0.00,0.00,720.00,1280.00)不透明1 <0x616b4bd8> 07-18 00:15:18.777 13333-13333 / com.salahahmed.zaker D / OpenGLRenderer:完成<0x616b4bd8> 07-18 00:15:18.801 13333-13333 / com.salahahmed.zaker I / View:修改调度到android.support.v7.widget.AppCompatButton {41ec73c0 VFED..C。 ... P .... 0,96-720,192#7f080035 app:id / button_upload},事件= MotionEvent {action = ACTION_UP,id [0] = 0,x [0] = 481.33148,y [0] = 80.73535 ,toolType [0] = TOOL_TYPE_FINGER,buttonState = 0,metaState = 0,标志= 0x0,edgeFlags = 0x0,pointerCount = 1,historySize = 0,eventTime = 5759331,downTime = 5759257,deviceId = 2,source = 0x1002} 07-18 00:15:18.801 13333-13333 / com.salahahmed.zaker V / Provider / Settings:来自设置缓存,name = sound_effects_enabled,value = 0 07-18 00:15:18.805 13333-13333 / com.salahahmed.zaker D / ActivityThread:hoder:android.app.IActivityManager $ ContentProviderHolder @ 43924e40,provider,holder.Provider:android.content.ContentProviderProxy@439259d8 07-18 00:15:18.812 13333-13333 / com.salahahmed.zaker E /准备上传:: /storage/sdcard0/Download/1197.pdf 07-18 00:15:18.816 13333-13333 / com.salahahmed.zaker E /开始:上传 07-18 00:15:18.820 13333-13333 / com.salahahmed.zaker D / OpenGL渲染器:prepareDirty(0.00,0.00,720.00,1280.00)不透明1 <0x616b4bd8> 07-18 00:15:18.822 13333-13333 / com.salahahmed.zaker D / OpenGLRenderer:完成<0x616b4bd8> 07-18 00:15:18.823 13333-13333 / com.salahahmed.zaker D / ActivityThread:SVC创建服务:CreateServiceData{token=android.os.BinderProxy@43928498 className = net.gotev.uploadservice.UploadService packageName = com。 salahahmed.zaker intent = null} 07-18 00:15:18.826 13333-13333 / com.salahahmed.zaker D / ActivityThread:SVC-CREATE_SERVICE已处理:0 / CreateServiceData{token=android.os.BinderProxy@43928498 className = net.gotev.uploadservice.UploadService packageName = com.salahahmed.zaker intent = null} SVC调用onStartCommand:net.gotev.uploadservice.UploadService@43929c70,标志= 0,startId = 1 07-18 00:15:18.829 13333-13333 / com.salahahmed.zaker D / dalvikvm:创建插入线程:堆栈大小= 128KB 创建新线程 07-18 00:15:18.830 13333-13333 / com.salahahmed.zaker D / dalvikvm:创建了新线程 更新线程列表 07-18 00:15:18.830 13333-17917 / com.salahahmed.zaker D / dalvikvm:threadid = 17:interp stack at 0x63091000 threadid = 17:从interp创建 07-18 00:15:18.831 13333-13333 / com.salahahmed.zaker D / dalvikvm:启动新线程 07-18 00:15:18.831 13333-17917 / com.salahahmed.zaker D / dalvikvm:线程ID = 17:通知调试器 threadid = 17(pool-6-thread-1):调用run() 07-18 00:15:18.834 13333-13333 / com.salahahmed.zaker D / ActivityThread:处理的SVC-SERVICE_ARGS:0 / ServiceArgsData {token=android.os.BinderProxy@43928498 startId = 1 args = Intent {act = com。 salahahmed.zaker.uploadservice.action.upload cmp = com.salahahmed.zaker / net.gotev.uploadservice.UploadService(有其他功能)}} 07-18 00:15:18.887 13333-17917 / com.salahahmed.zaker D / libc-netbsd:getaddrinfo:abdosalahas108.000webhostapp.com从代理获取结果>> 07-18 00:15:18.888 13333-17917 / com.salahahmed.zaker I / System.out:propertyValue:true 07-18 00:15:18.889 13333-17917 / com.salahahmed.zaker I / System.out:[CDS] rx超时时间:18000000 07-18 00:15:18.889 13333-17917 / com.salahahmed.zaker I / System.out:[套接字] [4]连接abdosalahas108.000webhostapp.com/145.14.145.22:80;LocalPort=51788(18000000) [CDS] connect [abdosalahas108.000webhostapp.com/145.14.145.22:80] tm:18000 07-18 00:15:18.890 13333-17917 / com.salahahmed.zaker D / Posix:[Posix_connect Debug]处理com.salahahmed.zaker:80 07-18 00:15:19.114 13333-17917 / com.salahahmed.zaker I / System.out:[socket] [/ 192.168.1.4:51788]已连接 [CDS] RX超时:18000000 07-18 00:15:19.289 13333-13333 / com.salahahmed.zaker D / OpenGL渲染器:prepareDirty(0.00,0.00,720.00,1280.00)不透明1 <0x616b4bd8> 07-18 00:15:19.291 13333-13333 / com.salahahmed.zaker D / OpenGLRenderer:完成<0x616b4bd8> 07-18 00:15:19.785 13333-13333 / com.salahahmed.zaker D / OpenGL渲染器:prepareDirty(0.00,0.00,720.00,1280.00)不透明1 <0x616b4bd8> 07-18 00:15:19.786 13333-13333 / com.salahahmed.zaker D / OpenGLRenderer:完成<0x616b4bd8> 07-18 00:15:20.039 13333-13333 / com.salahahmed.zaker D / OpenGL渲染器:prepareDirty(0.00,0.00,720.00,1280.00)不透明1 <0x616b4bd8> 07-18 00:15:20.041 13333-13333 / com.salahahmed.zaker D / OpenGLRenderer:完成<0x616b4bd8> 07-18 00:17:13.099 13333-17917 / com.salahahmed.zaker I / System.out:[CDS]写入为:2144/4096 [CDS]写入exceptionCount:0 07-18 00:17:13.100 13333-17917 / com.salahahmed.zaker I / System.out:[CDS]关闭[51788] 07-18 00:17:13.101 13333-17917 / com.salahahmed.zaker I / System.out:关闭[套接字] [/ 0.0.0.0:51788] 07-18 00:17:13.103 13333-17917 / com.salahahmed.zaker V / Provider / Settings:从设置缓存中,name = notification_sound,value = content:// media / internal / audio / media / 40 07-18 00:17:13.103 13333-17917 / com.salahahmed.zaker I / RingtoneManager:获取实际的默认铃声uri = content:// media / internal / audio / media / 40 07-18 00:17:13.130 13333-17917 / com.salahahmed.zaker D / dalvikvm:创建插入线程:堆栈大小= 128KB 创建新线程 创建新线程 更新线程列表 07-18 00:17:13.132 13333-18017 / com.salahahmed.zaker D / dalvikvm:线程ID = 23:Interp堆栈位于0x63178000 threadid = 23:从interp创建 07-18 00:17:13.132 13333-17917 / com.salahahmed.zaker D / dalvikvm:启动新线程 07-18 00:17:13.133 13333-18017 / com.salahahmed.zaker D / dalvikvm:threadid = 23:通知调试器 threadid = 23(UploadServiceIdleTimer):调用run() 07-18 00:17:23.133 13333-13333 / com.salahahmed.zaker D / ActivityThread:SVC销毁服务:net.gotev.uploadservice.UploadService@43929c70 07-18 00:17:23.134 13333-17917 / com.salahahmed.zaker D / dalvikvm:threadid = 17:正在退出 threadid = 17:再见! 07-18 00:17:23.136 13333-13333 / com.salahahmed.zaker D / ActivityThread:SVC-STOP_SERVICE处理:0 / android.os.BinderProxy@43928498 07-18 00:20:04.258 13333-16781 / com.salahahmed.zaker D / dalvikvm:threadid = 20:正在退出 threadid = 20:再见!
对不起,我的日志。