Issue while uploading Image
Sir, Library throws an Exception Illegal State Exception (closed) while uploading the file as multipart. Please check
Can you please provide me more detail like request?
I am having the same issue, here's an what I am doing, hope this helps:
val imageFile = File(uri.path!!)
if (imageFile.exists()) {
println("imageFile check $imageFile")
} else {
println("imageFile does not exist")
}
I do get confirmation that file exists and I made myself an Alertview to confirm that the Uri I am using points to the correct image.
Then using the file I send an upload request with your wonderful Library:
AndroidNetworking.upload("https://url.com/api/photo/upload")
.addHeaders("Auth", managerToken)
.addMultipartParameter("parent_id", parentIdString)
.addMultipartParameter("parent_type", parentTypeString)
.addMultipartFile("file", imageFile)
.addMultipartParameter("comment", imageCommentString)
.setPriority(Priority.HIGH)
.build()
I get the error message:
error: com.androidnetworking.error.ANError: java.lang.IllegalStateException: closed
This was working very well until I updated Android Studio, I'm not sure if it's a coincidence though.
have you solved the issue?
I am getting the exact error
error: com.androidnetworking.error.ANError: java.lang.IllegalStateException: closed
have you solved the issue?
I am getting the exact error
error: com.androidnetworking.error.ANError: java.lang.IllegalStateException: closed
Keskin, is the file you are trying to upload a saved photo uri?
Yes, it is a photo from the gallery. I am using Rx2AndroidNetworking
Rx2AndroidNetworking.upload(ApiEndPoint.ENDPOINT_UPLOAD_PHOTO)
.setOkHttpClient(okHttpClient)
.addMultipartFile("file", file)
.build()
.getObjectObservable(ApiResponse.class);
When I check out Stetho, I can see that it generates the request with headers, but I see that the response is empty. I think it can't send to the server. When I check the server logs, I see that this request has not been received.
I have disabled stetho in okHttpClient and now it is working. Is there any way to get this done without disabling the logging?
I have the same problem
I have the same problem
I am also facing same problem.
I am getting this error
com.androidnetworking.error.ANError: com.androidnetworking.error.ANError: java.io.FileNotFoundException: /document/document:57027: open failed: ENOENT (No such file or directory)
here is my code:
AndroidNetworking.upload(Config.add_assignment) .addMultipartParameter("subject_id", getSubjectId) .addMultipartParameter("subject_name",getSubjectName) .addMultipartFile("assigment", new File(PathHolder)) // .addMultipartFile("assigment", new File(encodedPdf)) .setContentType("Content-type: multipart/form-data; charset=utf-8") .setTag("addAssignment") .setPriority(Priority.MEDIUM) .build()
.getAsString(new StringRequestListener() {
@Override
public void onResponse(String response) {
Toast.makeText(AddPdf_StudyMaterialActivity.this,"File Uploaded Successfully......!", Toast.LENGTH_SHORT).show();
Intent intent=new Intent(AddPdf_StudyMaterialActivity.this, StudyPortalActivity.class);
startActivity(intent);
finish();
}
I am also having the same problem. Is there any solution for this?
I am also having the same problem. Is there any solution for this?
maksure logging feature is not active