cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Are you interested in hearing how one of our Community members uses Dropbox for sailing trips? Read all about it here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Upload SQLite Not a Database

Upload SQLite Not a Database

datan3rd
Explorer | Level 3
Go to solution

I have been able to get the Dropbox SDK working for objective C. The problem I am running into is that when I upload my backup of a SQLite database it is no longer being recognized as a DB. After some searching it seems that the issue may be that upon upload the DB may be in use. Any assistance on how to ensure it is not in use before uploading or kill any processes that may be using it? Additionally I noticed that the code for uploading uses "uploadData" whereas the code for downloading uses "downloadURL" - could that have anyhting to do with it?

1 Accepted Solution

Accepted Solutions

Greg-DB
Dropbox Staff
Go to solution

The example I linked to happens to use uploadData, but you can also pass a 'mode' to uploadUrl. Constructing and passing the mode works the same way for both.

View solution in original post

4 Replies 4

datan3rd
Explorer | Level 3
Go to solution

UPDATE: good news is I was able to find some code that worked in uploading the file and the subsequent download and restore is now working.

New smaller issue:

I need to figure out the code to allow overwrite as if the backup already exists then it will fail on upload currently. 

 

   [[client.filesRoutes uploadUrl:@"/backups/Backup.sqlite" inputUrl:databasePath]
     setResponseBlock:^(DBFILESFileMetadata *metadata, DBFILESUploadError *uploadError, DBRequestError *error) {
         if (metadata) {
             NSLog(@"The upload completed successfully.");
             NSLog(@"File metadata:");
             NSLog(@"%@", metadata);
             [self enableRestore];
         } else if (uploadError) {
             NSLog(@"Something went wrong with the upload:");
             NSLog(@"%@", uploadError);
         } else if (error) {
             NSLog(@"Something went wrong with the API call:");
             NSLog(@"%@", error);
         }
     }];

Greg-DB
Dropbox Staff
Go to solution

I'm glad to hear you already sorted out the original issue.

To control overwriting, you should use this version of the uploadUrl method, which takes a 'mode' parameter. The 'mode' parameter accepts a DBFILESWriteMode object, which you can set to your desired write mode, such as "Overwrite". There's an example of that here.

datan3rd
Explorer | Level 3
Go to solution

Greg - thanks as always for the reply. This code is where I started from. Using that code (uploadData) the SQLite file was not retaining itself as a DB. Switching to the code I have now with uploadUrl is functioning as expected with the exception of the overwrite issue. I will chose the overwrite issue and possibly just code around it if there is no alternative.

Greg-DB
Dropbox Staff
Go to solution

The example I linked to happens to use uploadData, but you can also pass a 'mode' to uploadUrl. Constructing and passing the mode works the same way for both.

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropbox Staff
  • User avatar
    datan3rd Explorer | Level 3
What do Dropbox user levels mean?