cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Whether you are transferring a single drive, a team or an entire organization, Movebot's cloud migration tool has been built to make your Dropbox migration simple - learn 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: 

Update files (images) and keep creation date

Update files (images) and keep creation date

Nuno G.2
New member | Level 2

Hi,

 

I'm using the upload api to send some images to my Dropbox account. What I'm noticing is that the images' creation dates are being set to the upload date. So if I took a picture yesterday on my iPhone, and today sending it on my app, through the Dropbox API, the creation date is "now". That's rather unfortunate. The Camera Upload folder keeps the creation date on the files though, so I would like to know if that's possible.

 

Being a bit more technical, I'll post some code. I'm using Swift 3 and iOS 10.

 

I'm actually fetching the Image Data through: 

PHAsset.fetchAssets(withALAssetURLs: [imageLocalUrl], options: nil)

PHImageManager.default()
.requestImageData(for: asset,
options: requestOptions) { resultData, response, orientation, info in data = resultData }

Then using the Dropbox upload api like this:

 

DropboxClientsManager
.authorizedClient
.files
.upload(path: "<path/to/folder/imageName.jpg>", input: data)

 

Thank you

1 Accepted Solution

Accepted Solutions

Re: Update files (images) and keep creation date

Greg-DB
Dropboxer

I see, thanks for clarifying. In that case, in order to preserve that when uploading via the API, set the clientModified to be the expected time when calling upload.

View solution in original post

4 Replies 4

Re: Update files (images) and keep creation date

Greg-DB
Dropboxer
What piece of metadata are you looking at specifically when you refer to the file's creation date? Can you share a sample? Thanks in advance!

Re: Update files (images) and keep creation date

Nuno G.2
New member | Level 2

Not sure. I was actually thinking this would be automatically. 

 

In Finder (macOS) I'm actually seeing this on an image that I just uploaded but the picture itself was taken well before. 

 

https://www.dropbox.com/s/i8v58nrq1igjj0b/Screenshot%202016-12-13%2021.46.04.png?dl=0

 

The Camera Upload folder keeps the dates propperly according to the photo creation date. 

Re: Update files (images) and keep creation date

Greg-DB
Dropboxer

I see, thanks for clarifying. In that case, in order to preserve that when uploading via the API, set the clientModified to be the expected time when calling upload.

Re: Update files (images) and keep creation date

Nuno G.2
New member | Level 2

Thank you very much. I hadn't found that documentation yet. Shame on me. Thanks again.

Who's talking

Top contributors to this post

  • User avatar
    Nuno G.2 New member | Level 2
  • User avatar
    Greg-DB Dropboxer
What do Dropbox user levels mean?
Need more support?