c# - How do I upload to dropbox using dropnet? -
i using dropnet. have problem upload file dropbox. sure connection dropbox in fine. when changed method of upload create file , delete file method works fine. can not see problem why not uploading? use same api dropnet.
protected void btn_upload_click(object sender, eventargs e) { if (fileupload1.hasfile) { if (session["dropnetuserlogin"] != null) { try { _client.usesandbox = true; _client.uploadfile("/", fileupload1.filename, fileupload1.filebytes); } catch (exception ex) { litoutput.text = "error in upload user login in session " + ex.message; } } else { litoutput.text = "session expired..."; } } else { litoutput.text = "you did not specify file upload."; } } }
here code worked me, hoping may you:
private void button1_click(object sender, routedeventargs e) { var dlg = new openfiledialog(); dlg.filter = "text documents (.txt)|*.txt"; nullable<bool> result = dlg.showdialog(); if (result == true) { string filename = dlg.filename; filenametextbox.text = filename; } var x = @"/" + path.getfilename(filenametextbox.text); _client.uploadfile("/", path.getfilename(filenametextbox.text), file.readallbytes(@"" + filenametextbox.text)); }