<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: API V2 Can't get large file Upload working in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/API-V2-Can-t-get-large-file-Upload-working/m-p/159949#M5480</link>
    <description>&lt;P&gt;Thanks! This error should just indicate an issue with the path you're supplying, but your path ("/AccountInfo.json") looks fine, so we're currently investigating if/what the issue might be on our side.&lt;/P&gt;</description>
    <pubDate>Tue, 24 Nov 2015 01:58:45 GMT</pubDate>
    <dc:creator>Greg-DB</dc:creator>
    <dc:date>2015-11-24T01:58:45Z</dc:date>
    <item>
      <title>API V2 Can't get large file Upload working</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/API-V2-Can-t-get-large-file-Upload-working/m-p/159944#M5475</link>
      <description>&lt;P&gt;Some context for the following:&lt;BR /&gt;1) DBAPIMetadata is just my wrapper for Files.Metadata that I can pass to Objective-C&lt;BR /&gt;2) The BGHelper at the end (when the call is not on the MainThread) just call the function&lt;BR /&gt; On the main thread and blocks the background thread until it completes.&lt;BR /&gt; Basically any calls on the main thread are async and those on the background thread are&lt;BR /&gt; synchronous for my use.&lt;/P&gt;
&lt;P&gt;What succeeds ..&lt;BR /&gt;1) I pass an empty NDData to filesUploadSessionStart and get a session.&lt;BR /&gt;2) I pass the NSData with the real data to filesUploadSessionAppend &lt;BR /&gt; Data was smaller than MaxLength so everything was transfer in the first call to ProcessNextBlock&lt;BR /&gt;3) On successfull completion it tried to call filesUploadSessionAppend&lt;BR /&gt; Here I get:&lt;/P&gt;
&lt;P&gt;DropboxAPI:UploadFile:SessionFinish:[request-id 9dc97cd33ec9680b0ea58decc87cc4dd] API route error - handle programmatically&lt;/P&gt;
&lt;P&gt;Previously I tried to NOT use filesUploadSessionAppend when a single transfer would work and send the data in filesUploadSessionAppend ... that failed as well with a different error.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Sorry the following really gets mangled on this forum ... it's just a single Swift function that handles the transfer.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt; func UploadFile(dbPath:String, toPath:String, withParentRev:String, fromPath:String, completion: (DBAPIMetadata?) -&amp;gt; Void) -&amp;gt; Void {&lt;BR /&gt; if (NSThread.isMainThread()) {&lt;BR /&gt; // Context for Process Next&lt;BR /&gt; let ins = NSInputStream(fileAtPath: fromPath)&lt;BR /&gt; ins!.open()&lt;BR /&gt; let MaxLength = 1024 * 1024 * 2&lt;BR /&gt; var transferCnt:UInt64 = 0&lt;BR /&gt; var buffer = Array&amp;lt;UInt8&amp;gt;(count:MaxLength, repeatedValue:0)&lt;BR /&gt; var data = NSData.init(bytesNoCopy: &amp;amp;buffer, length:MaxLength, freeWhenDone:false)&lt;BR /&gt; var sessionID = ""&lt;BR /&gt; var retry = 0&lt;/P&gt;
&lt;P&gt;// Initially blank ... so it can call itself&lt;BR /&gt; var ProcessNextBlock:() -&amp;gt; Void = { () -&amp;gt; Void in }&lt;BR /&gt; ProcessNextBlock = { &lt;BR /&gt; () in&lt;BR /&gt; let readCnt = ins!.read(&amp;amp;buffer, maxLength: MaxLength)&lt;BR /&gt; if (readCnt &amp;gt; 0) {&lt;BR /&gt; if (readCnt != MaxLength) {&lt;BR /&gt; data = NSData.init(bytesNoCopy: &amp;amp;buffer, length:(readCnt &amp;gt;= 0 ? readCnt: 0), freeWhenDone:false)&lt;BR /&gt; }&lt;BR /&gt; // Initiall blank ... so it can call itself&lt;BR /&gt; var compClosure:((Void)?, CallError&amp;lt;(Files.UploadSessionLookupError)&amp;gt;?) -&amp;gt; Void = { (_, _) -&amp;gt; Void in }&lt;BR /&gt; compClosure = { &lt;BR /&gt; (response, errorType) in&lt;BR /&gt; if errorType != nil {&lt;BR /&gt; // Lets Rety&lt;BR /&gt; retry++&lt;BR /&gt; if (retry &amp;lt; 4) {&lt;BR /&gt; self.mClient.filesUploadSessionAppend(sessionId:sessionID, offset:transferCnt, body:data).response(compClosure)&lt;BR /&gt; } else {&lt;BR /&gt; PersistLog.e(self.TAG, andMsg: "UploadFile:SessionAppend:" + fromPath)&lt;BR /&gt; PersistLog.e(self.TAG, andMsg: "UploadFile:SessionAppend:" + errorType!.description)&lt;BR /&gt; completion(nil)&lt;BR /&gt; }&lt;BR /&gt; } else {&lt;BR /&gt; transferCnt = transferCnt + UInt64(readCnt)&lt;BR /&gt; retry = 0&lt;BR /&gt; ProcessNextBlock()&lt;BR /&gt; }&lt;BR /&gt; }&lt;BR /&gt; self.mClient.filesUploadSessionAppend(sessionId:sessionID, offset:transferCnt, body:data).response(compClosure)&lt;BR /&gt; } else {&lt;BR /&gt; // Send the last non full block with filesUploadSession Finish&lt;BR /&gt; if (transferCnt &amp;gt; 0) {&lt;BR /&gt; let cursor = Files.UploadSessionCursor(sessionId: sessionID, offset: transferCnt)&lt;BR /&gt; let info = Files.CommitInfo(path: dbPath)&lt;BR /&gt; self.mClient.filesUploadSessionFinish(cursor: cursor, commit: info, body: NSData()).response( {&lt;BR /&gt; (response, errorType) in&lt;BR /&gt; if let (meta) = response {&lt;BR /&gt; completion(DBAPIMetadata(meta:meta))&lt;BR /&gt; } else {&lt;BR /&gt; PersistLog.e(self.TAG, andMsg: "UploadFile:SessionFinish:" + fromPath)&lt;BR /&gt; PersistLog.e(self.TAG, andMsg: "UploadFile:SessionFinish:" + errorType!.description)&lt;BR /&gt; completion(nil)&lt;BR /&gt; }&lt;BR /&gt; })&lt;BR /&gt; } else {&lt;BR /&gt; PersistLog.e(self.TAG, andMsg: "UploadFile:NoData:" + fromPath)&lt;BR /&gt; completion(nil)&lt;BR /&gt; }&lt;BR /&gt; }&lt;BR /&gt; }&lt;BR /&gt; &lt;BR /&gt; // Start the Process - Use empty data just to get a Session ID&lt;BR /&gt; let tmp = NSData()&lt;BR /&gt; mClient.filesUploadSessionStart(body:tmp).response( {&lt;BR /&gt; (response, errorType) -&amp;gt; Void in&lt;BR /&gt; if let (startResult) = response {&lt;BR /&gt; sessionID = startResult.sessionId&lt;BR /&gt; ProcessNextBlock()&lt;BR /&gt; } else {&lt;BR /&gt; PersistLog.e(self.TAG, andMsg: "UploadFile:SessionStart:" + fromPath)&lt;BR /&gt; PersistLog.e(self.TAG, andMsg: "UploadFile:SessionStart:" + errorType!.description)&lt;BR /&gt; completion(nil)&lt;BR /&gt; }&lt;BR /&gt; })&lt;BR /&gt; } else {&lt;BR /&gt; PersistLog.i(TAG, andMsg: "UploadFile")&lt;BR /&gt; let BG = BGHelper&amp;lt;DBAPIMetadata&amp;gt;(completion:completion)&lt;BR /&gt; BG.CallerStart( {&lt;BR /&gt; self.UploadFile(dbPath, toPath:toPath, withParentRev:withParentRev, fromPath: fromPath, completion: BG.completion)&lt;BR /&gt; })&lt;BR /&gt; BG.CallerWait()&lt;BR /&gt; }&lt;BR /&gt; }&lt;/P&gt;</description>
      <pubDate>Wed, 29 May 2019 09:38:15 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/API-V2-Can-t-get-large-file-Upload-working/m-p/159944#M5475</guid>
      <dc:creator>RTS S.</dc:creator>
      <dc:date>2019-05-29T09:38:15Z</dc:date>
    </item>
    <item>
      <title>Re: API V2 Can't get large file Upload working</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/API-V2-Can-t-get-large-file-Upload-working/m-p/159945#M5476</link>
      <description>&lt;P&gt;Thanks for the detailed write-up. We'll be happy to help. First, a few things:&lt;/P&gt;
&lt;P&gt;- Just to make sure, in step 3, you meant "filesUploadSessionFinish" not "filesUploadSessionAppend" right?&lt;/P&gt;
&lt;P&gt;- Can you share the log output for reference?&lt;/P&gt;
&lt;P&gt;- Can you share the value of dbPath?&lt;/P&gt;
&lt;P&gt;Thanks in advance!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Nov 2015 08:20:50 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/API-V2-Can-t-get-large-file-Upload-working/m-p/159945#M5476</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2015-11-20T08:20:50Z</dc:date>
    </item>
    <item>
      <title>Re: API V2 Can't get large file Upload working</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/API-V2-Can-t-get-large-file-Upload-working/m-p/159946#M5477</link>
      <description>&lt;P&gt;Oops ... I meant that the filesUploadSessionFinish failed.&lt;/P&gt;
&lt;P&gt;In two cases ... the one I just reported on was with an empty &amp;nbsp;NSDATA() &amp;nbsp;as the body.&lt;/P&gt;
&lt;P&gt;Previously I also had a problem when I passed and NSDATA object with data ... It failed with a different error.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The dbPath was &amp;nbsp;/AccountInfo.json &amp;nbsp; ... logged in as my APP context.&lt;/P&gt;
&lt;P&gt;Where were no errors in the console .. just the info I sent you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Nov 2015 09:52:39 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/API-V2-Can-t-get-large-file-Upload-working/m-p/159946#M5477</guid>
      <dc:creator>RTS S.</dc:creator>
      <dc:date>2015-11-20T09:52:39Z</dc:date>
    </item>
    <item>
      <title>Re: API V2 Can't get large file Upload working</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/API-V2-Can-t-get-large-file-Upload-working/m-p/159947#M5478</link>
      <description>&lt;P&gt;Thanks. We're looking into it. In the meantime, please make sure you're using the latest version of the SDK. (&lt;A href="https://github.com/dropbox/SwiftyDropbox/releases" target="_blank" rel="nofollow noreferrer"&gt;Currently 1.0 on GitHub&lt;/A&gt;)&lt;/P&gt;</description>
      <pubDate>Sat, 21 Nov 2015 06:41:42 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/API-V2-Can-t-get-large-file-Upload-working/m-p/159947#M5478</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2015-11-21T06:41:42Z</dc:date>
    </item>
    <item>
      <title>Re: API V2 Can't get large file Upload working</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/API-V2-Can-t-get-large-file-Upload-working/m-p/159948#M5479</link>
      <description>&lt;P&gt;I upgraded to API Version 1.0&lt;/P&gt;
&lt;P&gt;Here is the debugger output of the input variables before calling&amp;nbsp;filesUploadSessionFinish and after getting the response:&lt;/P&gt;
&lt;P&gt;Printing description of cursor:&lt;BR /&gt;{&lt;BR /&gt; offset = 82995;&lt;BR /&gt; "session_id" = AAAAAAAAEHSrFUSNImgWDg;&lt;BR /&gt;}&lt;BR /&gt;Printing description of info:&lt;BR /&gt;{&lt;BR /&gt; autorename = 0;&lt;BR /&gt; mode = {&lt;BR /&gt; ".tag" = add;&lt;BR /&gt; };&lt;BR /&gt; mute = 0;&lt;BR /&gt; path = "/AccountInfo.json";&lt;BR /&gt;}&lt;BR /&gt;Printing description of errorType:&lt;BR /&gt;(SwiftyDropbox.CallError&amp;lt;SwiftyDropbox.Files.UploadSessionFinishError&amp;gt;?) errorType = RouteError {&lt;BR /&gt; RouteError = {&lt;BR /&gt; 0 = 0x000000012cf15130 {&lt;BR /&gt; unboxed = LookupFailed {&lt;BR /&gt; LookupFailed = IncorrectOffset {&lt;BR /&gt; IncorrectOffset = 0x0000000103980030 (correctOffset = 6869401272)&lt;BR /&gt; }&lt;BR /&gt; }&lt;BR /&gt; }&lt;BR /&gt; 1 = "b5f5e7b4401cc6c0ac522b26c6aafee3"&lt;BR /&gt; }&lt;BR /&gt;}&lt;BR /&gt;UploadFile:SessionFinish:[request-id b5f5e7b4401cc6c0ac522b26c6aafee3] API route error - handle programmatically&lt;/P&gt;</description>
      <pubDate>Sat, 21 Nov 2015 20:54:33 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/API-V2-Can-t-get-large-file-Upload-working/m-p/159948#M5479</guid>
      <dc:creator>RTS S.</dc:creator>
      <dc:date>2015-11-21T20:54:33Z</dc:date>
    </item>
    <item>
      <title>Re: API V2 Can't get large file Upload working</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/API-V2-Can-t-get-large-file-Upload-working/m-p/159949#M5480</link>
      <description>&lt;P&gt;Thanks! This error should just indicate an issue with the path you're supplying, but your path ("/AccountInfo.json") looks fine, so we're currently investigating if/what the issue might be on our side.&lt;/P&gt;</description>
      <pubDate>Tue, 24 Nov 2015 01:58:45 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/API-V2-Can-t-get-large-file-Upload-working/m-p/159949#M5480</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2015-11-24T01:58:45Z</dc:date>
    </item>
    <item>
      <title>Re: API V2 Can't get large file Upload working</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/API-V2-Can-t-get-large-file-Upload-working/m-p/159950#M5481</link>
      <description>&lt;P&gt;Some more &amp;nbsp;problems with uploads (Version 1.0) ...&lt;/P&gt;
&lt;P&gt;let ins = NSInputStream(fileAtPath: fromPath)&lt;/P&gt;
&lt;P&gt;client.files.upload(path:"/AccountInfo.json", ins!)&lt;/P&gt;
&lt;P&gt;I also get the following response error:&lt;/P&gt;
&lt;P&gt;Printing description of errorType:&lt;BR /&gt;(SwiftyDropbox.CallError&amp;lt;SwiftyDropbox.Files.UploadError&amp;gt;?) errorType = RouteError {&lt;BR /&gt; RouteError = {&lt;BR /&gt; 0 = 0x000000015cedf080 {&lt;BR /&gt; unboxed = Path {&lt;BR /&gt; Path = 0x0000000104594030 {&lt;BR /&gt; reason = MalformedPath {&lt;BR /&gt; MalformedPath = "&lt;BR /&gt; }&lt;BR /&gt; uploadSessionId = unable to read data&lt;BR /&gt; }&lt;BR /&gt; }&lt;BR /&gt; }&lt;BR /&gt; 1 = "4c780c956d3e116ae75fdeee8c7435f3"&lt;BR /&gt; }&lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;Also if I read the stream into an NSData object and pass the NSData object to the files.upload call instead of the NSInputStream ... I get an exception ... like its trying to read a stream.&lt;/P&gt;
&lt;P&gt;A note on this issue and previous issue ... the "/AccountInfo.json" file already exists on dropbox ... I am trying to update it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have not been able to use any Variation of your API's to upload this file!!!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 29 Nov 2015 05:28:07 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/API-V2-Can-t-get-large-file-Upload-working/m-p/159950#M5481</guid>
      <dc:creator>RTS S.</dc:creator>
      <dc:date>2015-11-29T05:28:07Z</dc:date>
    </item>
    <item>
      <title>Re: API V2 Can't get large file Upload working</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/API-V2-Can-t-get-large-file-Upload-working/m-p/159951#M5482</link>
      <description>&lt;P&gt;Thanks! This&amp;nbsp;version of the code simplifies things. This version does work for me, and I believe&amp;nbsp;the error you're getting is a "file"&amp;nbsp;WriteConflictError, meaning there's already a file at the path you're trying to upload to:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.dropbox.com/developers/documentation/http#documentation-files-upload" rel="nofollow noreferrer"&gt;https://www.dropbox.com/developers/documentation/http#documentation-files-upload&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;You can specify a WriteMode to change how this scenario is handled.&lt;/P&gt;
&lt;P&gt;We're working on getting the SwiftyDropbox specific documentation ready, as well as improving the error reporting in SwiftyDropbox itself.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 01 Dec 2015 06:11:41 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/API-V2-Can-t-get-large-file-Upload-working/m-p/159951#M5482</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2015-12-01T06:11:41Z</dc:date>
    </item>
    <item>
      <title>Re: API V2 Can't get large file Upload working</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/API-V2-Can-t-get-large-file-Upload-working/m-p/159952#M5483</link>
      <description>&lt;P&gt;Yep, my upload (with an input stream) and Session upload with chunks of NSData &amp;nbsp;worked after settings the WriteMode (In the latter case the upload always worked, it was the finishing the session and saving the filed that failed)&lt;/P&gt;
&lt;P&gt;The error messages are terrible and I would have never guessed from the error what the problem was. Even now looking back I would not have been able to interpret the error.&lt;/P&gt;
&lt;P&gt;The last problem &amp;nbsp;was mine... upload with an NSData object (I did not show the code) &amp;nbsp;was a memory management problem. I used an NSData object that did not copy the buffer and the buffer was deleted before it was processed.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;All is good ... with multiple techniques to upload a file.&lt;/P&gt;</description>
      <pubDate>Wed, 02 Dec 2015 04:50:25 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/API-V2-Can-t-get-large-file-Upload-working/m-p/159952#M5483</guid>
      <dc:creator>RTS S.</dc:creator>
      <dc:date>2015-12-02T04:50:25Z</dc:date>
    </item>
    <item>
      <title>Re: API V2 Can't get large file Upload working</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/API-V2-Can-t-get-large-file-Upload-working/m-p/159953#M5484</link>
      <description>&lt;P&gt;Thanks for the feedback on the error messages! We've made some changes to how this is reported, so if you pod update (latest is 1.0.2) issues like this should yield better messages.&lt;/P&gt;</description>
      <pubDate>Fri, 04 Dec 2015 04:58:46 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/API-V2-Can-t-get-large-file-Upload-working/m-p/159953#M5484</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2015-12-04T04:58:46Z</dc:date>
    </item>
  </channel>
</rss>

