java - Operation finished with HTTP status code 409 (fail) -
hello there working on next cloud api, , trying upload image device as:
uploadbutton.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { showfilechooser(); } }); private void showfilechooser() { intent intent = new intent(intent.action_get_content); intent.settype("*/*"); intent.addcategory(intent.category_openable); try { startactivityforresult( intent.createchooser(intent, "select file upload"),file_select_code); } catch (android.content.activitynotfoundexception ex) { // potentially direct user market dialog toast.maketext(this, "please install file manager.", toast.length_short).show(); } } and on activity result as:
@override protected void onactivityresult(int requestcode, int resultcode, intent data) { switch (requestcode) { case file_select_code: if (resultcode == result_ok) { try { // uri of selected file uri uri = data.getdata(); // path string path = getpath(mainactivity.this, uri); file fi = new file(path); //set image image view iv.setimageuri(uri.fromfile(fi)); date lastmoddate = new date(fi.lastmodified()); startupload(fi, "/testfolder", getmimetype2(uri.fromfile(fi)),lastmoddate.tostring()); log.e(tag, "file " + fi.tostring() + " remote path " + mserveruri + " mime " + getmimetype2(uri.fromfile(fi))+" date "+lastmoddate.tostring()); } catch (exception e) { log.e(tag, "eee " + e.tostring()); } } break; } super.onactivityresult(requestcode, resultcode, data); } public static string getpath(context context, uri uri) throws urisyntaxexception { if ("content".equalsignorecase(uri.getscheme())) { string[] projection = {"_data"}; cursor cursor = null; try { cursor = context.getcontentresolver().query(uri, projection, null, null, null); int column_index = cursor.getcolumnindexorthrow("_data"); if (cursor.movetofirst()) { return cursor.getstring(column_index); } } catch (exception e) { // eat } } else if ("file".equalsignorecase(uri.getscheme())) { return uri.getpath(); } return null; } though created new folder using api documentation , works , created folder! although every working in condition reading file next cloud too!
the problem image upload device! getting following error while trying upload:
operation finished http status code 409 (fail) i have no idea have been doing wrong, can please give idea being done wrong!
http error 409 means there confict resource on server. should check response server understand how resolve confict. more info: https://httpstatuses.com/409
Comments
Post a Comment