We are aware of the issue with the badge emails resending to everyone, we apologise for the inconvenience - learn more here.

Forum Discussion

Nuno G.2's avatar
Nuno G.2
New member | Level 2
8 years ago

Update files (images) and keep creation date

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

  • Greg-DB's avatar
    Greg-DB
    8 years ago

    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.

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Staff rankDropbox Staff
    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!
      • Greg-DB's avatar
        Greg-DB
        Icon for Dropbox Staff rankDropbox Staff

        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.

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

5,877 PostsLatest Activity: 12 months ago
326 Following

If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X or Facebook.

For more info on available support options for your Dropbox plan, see this article.

If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!