<?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: how to get file_id, file_size metadata using filename gotten from file chooser (python) in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/how-to-get-file-id-file-size-metadata-using-filename-gotten-from/m-p/231795#M12643</link>
    <description>&lt;P&gt;Here is what I have:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&amp;lt;script type="text/javascript" src="https://www.dropbox.com/static/api/2/dropins.js" id="dropboxjs" data-app-key="kuxx5m7ap1npv24"&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;script&amp;gt;
var options= {
multiselect: true,
//extensions: ['.png', '.jpg', '.mvp3', '.mvp4', '.doc', '.xls'],
linkType: 'preview',
success: function(files) {

var filenames;
var filepaths;
var fileids;
var filesizes;
var fileicons;
var filethumbnails;
&amp;nbsp;
//Parse file names and file paths from files. Store data into arrays.
var obj = files;

filenames=obj.name;
filepaths=obj.link;
fileicons=obj.id;
filesizes=obj.size;
fileicons=obj.icon;
filethumbnails=obj.thumbnailLink;
&amp;nbsp;
document.getElementById('linkfile').value = filepaths; 
document.getElementById('namefile').value = filenames;
document.getElementById('idfile').value = fileids;
document.getElementById('sizefile').value = filesizes;
document.getElementById('iconfile').value = fileicons;
document.getElementById('thumbnailfile').value = filethumbnails;
&amp;nbsp;
alert(filepaths);
alert(filenames);
alert(fileids); 
alert(filesizes);
alert(fileicons);
alert(filethumbnails);
};
},
};
$(document).ready(function() {
var button = Dropbox.createChooseButton(options);
document.getElementById('uploadDB').appendChild(button);
});
&amp;lt;/script&amp;gt;
&amp;lt;div id="uploadDB"&amp;gt;&amp;lt;/div&amp;gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I can get name, link, icon/thumbnail not size and nor id.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Q.&lt;/P&gt;</description>
    <pubDate>Wed, 12 Jul 2017 15:15:20 GMT</pubDate>
    <dc:creator>app5000</dc:creator>
    <dc:date>2017-07-12T15:15:20Z</dc:date>
    <item>
      <title>how to get file_id, file_size metadata using filename gotten from file chooser (python)</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/how-to-get-file-id-file-size-metadata-using-filename-gotten-from/m-p/231392#M12614</link>
      <description>&lt;P&gt;I have used dropbox file chooser to download files and filelinks. &amp;nbsp;After I extract the filenames using the file&amp;nbsp;chooser, I want to get more extended metadta.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To do that I first went through Oauth2, then I used the following python codes:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;fileid=dbx.files_get_metadata('/'+filename).id&lt;/PRE&gt;
&lt;P class="p1"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;but got the following error message:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="p1"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="p1"&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&amp;nbsp; File "/home/serve624/lib/python2.7/site-packages/dropbox/base.py", line 449, in files_get_metadata
&amp;nbsp; &amp;nbsp; None,
&amp;nbsp; File "/home/serve624/lib/python2.7/site-packages/dropbox/dropbox.py", line 272, in request
&amp;nbsp; &amp;nbsp; user_message_locale)
ApiError: ApiError('f865f89a9c9f0c3e53e7319f8d99e3cf', GetMetadataError(u'path', LookupError(u'not_found', None)))&lt;/PRE&gt;
&lt;P class="p1"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;Here is another line of python codes:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="p1"&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;filesize=dbx.files_get_metadata('/'+filename).size&lt;/PRE&gt;
&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="p1"&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&amp;nbsp; File "/home/serve624/lib/python2.7/site-packages/dropbox/base.py", line 449, in files_get_metadata
&amp;nbsp; &amp;nbsp; None,
&amp;nbsp; File "/home/serve624/lib/python2.7/site-packages/dropbox/dropbox.py", line 272, in request
&amp;nbsp; &amp;nbsp; user_message_locale)
ApiError: ApiError('25dcb0204364f0edcc35c33231877b85', GetMetadataError(u'path', LookupError(u'not_found', None)))&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;These two lines of python codes worked for some files from one account but not for files in another account. &amp;nbsp;I don't know what the error message means. &amp;nbsp;Could it be that the file path in the () is not correct? &amp;nbsp;If so how should I compose the file path? &amp;nbsp;How do I get the correct file path from the file chooser?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for your help.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 May 2019 09:20:50 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/how-to-get-file-id-file-size-metadata-using-filename-gotten-from/m-p/231392#M12614</guid>
      <dc:creator>app5000</dc:creator>
      <dc:date>2019-05-29T09:20:50Z</dc:date>
    </item>
    <item>
      <title>Re: how to get file_id, file_size metadata using filename gotten from file chooser (python)</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/how-to-get-file-id-file-size-metadata-using-filename-gotten-from/m-p/231452#M12620</link>
      <description>&lt;P&gt;When calling&amp;nbsp;files_get_metadata like this, you need to supply the full path and name for the file. If you don't supply the path to a file that exists, you'll get this not_found error.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The Chooser only returns the name of the file, and not the path. So, if the file happens to exist in root, your&amp;nbsp;files_get_metadata call will happen to find it. If it doesn't though, you won't have the right path, and the call will fail.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Alternatively, if you're using &lt;A href="https://www.dropbox.com/developers/chooser" target="_self"&gt;the web Chooser&lt;/A&gt;, you can get&amp;nbsp;the "id" returned by the Chooser and pass that to&amp;nbsp;files_get_metadata instead. The "id" was recently added to&amp;nbsp;the Chooser though, and isn't officially documented, so I can't promise it will be reliable.&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jul 2017 15:47:37 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/how-to-get-file-id-file-size-metadata-using-filename-gotten-from/m-p/231452#M12620</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2017-07-10T15:47:37Z</dc:date>
    </item>
    <item>
      <title>Re: how to get file_id, file_size metadata using filename gotten from file chooser (python)</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/how-to-get-file-id-file-size-metadata-using-filename-gotten-from/m-p/231556#M12624</link>
      <description>&lt;DIV id="yiv0238957004yui_3_16_0_ym19_1_1499701404855_11589"&gt;&lt;SPAN&gt;Hello Greg,&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV id="yiv0238957004yui_3_16_0_ym19_1_1499701404855_11590"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV id="yiv0238957004yui_3_16_0_ym19_1_1499701404855_11591" dir="ltr"&gt;I am using Dropbox Javascript file chooser, can I get fileid that way? &amp;nbsp;Assume I can, how can I use fileid to get modified time, client creation time and download the thumbnail?&lt;/DIV&gt;
&lt;DIV id="yiv0238957004yui_3_16_0_ym19_1_1499701404855_11591" dir="ltr"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV id="yiv0238957004yui_3_16_0_ym19_1_1499701404855_11591" dir="ltr"&gt;Q&lt;/DIV&gt;</description>
      <pubDate>Tue, 11 Jul 2017 00:08:31 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/how-to-get-file-id-file-size-metadata-using-filename-gotten-from/m-p/231556#M12624</guid>
      <dc:creator>app5000</dc:creator>
      <dc:date>2017-07-11T00:08:31Z</dc:date>
    </item>
    <item>
      <title>Re: how to get file_id, file_size metadata using filename gotten from file chooser (python)</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/how-to-get-file-id-file-size-metadata-using-filename-gotten-from/m-p/231664#M12631</link>
      <description>&lt;P&gt;Yes, using the JavaScript Chooser, get the 'id' from the result, just like you get the filename. Then, pass that directly into&amp;nbsp;files_get_metadata.&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jul 2017 13:57:39 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/how-to-get-file-id-file-size-metadata-using-filename-gotten-from/m-p/231664#M12631</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2017-07-11T13:57:39Z</dc:date>
    </item>
    <item>
      <title>Re: how to get file_id, file_size metadata using filename gotten from file chooser (python)</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/how-to-get-file-id-file-size-metadata-using-filename-gotten-from/m-p/231687#M12636</link>
      <description>&lt;P&gt;Hello Greg,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Just tried but fileid came up empty.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is the code I am using to get the values from returned response:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;filename=obj.name;&lt;BR /&gt; filepath=obj.link;&lt;BR /&gt; fileicon=obj.id;&lt;BR /&gt; filesize=obj.size;&lt;BR /&gt; fileicons=obj.icon;&lt;BR /&gt; filethumbnail=obj.thumbnailLink;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am not sure how to save the thumbnail image. &amp;nbsp;Should I save it as a file or is it in a string (as in a link) format?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Q&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jul 2017 15:42:30 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/how-to-get-file-id-file-size-metadata-using-filename-gotten-from/m-p/231687#M12636</guid>
      <dc:creator>app5000</dc:creator>
      <dc:date>2017-07-11T15:42:30Z</dc:date>
    </item>
    <item>
      <title>Re: how to get file_id, file_size metadata using filename gotten from file chooser (python)</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/how-to-get-file-id-file-size-metadata-using-filename-gotten-from/m-p/231792#M12642</link>
      <description>&lt;P&gt;Can you share the rest of your Chooser code? Accessing .id on the returned file object should give you the file ID.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also,&amp;nbsp;thumbnailLink is a URL that points to the data for the thumbnail. What you with that is up to you. E.g., you can make an HTTPS request to it to download the thumbnail data, and display it in your app.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jul 2017 00:57:25 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/how-to-get-file-id-file-size-metadata-using-filename-gotten-from/m-p/231792#M12642</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2017-07-12T00:57:25Z</dc:date>
    </item>
    <item>
      <title>Re: how to get file_id, file_size metadata using filename gotten from file chooser (python)</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/how-to-get-file-id-file-size-metadata-using-filename-gotten-from/m-p/231795#M12643</link>
      <description>&lt;P&gt;Here is what I have:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&amp;lt;script type="text/javascript" src="https://www.dropbox.com/static/api/2/dropins.js" id="dropboxjs" data-app-key="kuxx5m7ap1npv24"&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;script&amp;gt;
var options= {
multiselect: true,
//extensions: ['.png', '.jpg', '.mvp3', '.mvp4', '.doc', '.xls'],
linkType: 'preview',
success: function(files) {

var filenames;
var filepaths;
var fileids;
var filesizes;
var fileicons;
var filethumbnails;
&amp;nbsp;
//Parse file names and file paths from files. Store data into arrays.
var obj = files;

filenames=obj.name;
filepaths=obj.link;
fileicons=obj.id;
filesizes=obj.size;
fileicons=obj.icon;
filethumbnails=obj.thumbnailLink;
&amp;nbsp;
document.getElementById('linkfile').value = filepaths; 
document.getElementById('namefile').value = filenames;
document.getElementById('idfile').value = fileids;
document.getElementById('sizefile').value = filesizes;
document.getElementById('iconfile').value = fileicons;
document.getElementById('thumbnailfile').value = filethumbnails;
&amp;nbsp;
alert(filepaths);
alert(filenames);
alert(fileids); 
alert(filesizes);
alert(fileicons);
alert(filethumbnails);
};
},
};
$(document).ready(function() {
var button = Dropbox.createChooseButton(options);
document.getElementById('uploadDB').appendChild(button);
});
&amp;lt;/script&amp;gt;
&amp;lt;div id="uploadDB"&amp;gt;&amp;lt;/div&amp;gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I can get name, link, icon/thumbnail not size and nor id.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Q.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jul 2017 15:15:20 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/how-to-get-file-id-file-size-metadata-using-filename-gotten-from/m-p/231795#M12643</guid>
      <dc:creator>app5000</dc:creator>
      <dc:date>2017-07-12T15:15:20Z</dc:date>
    </item>
    <item>
      <title>Re: how to get file_id, file_size metadata using filename gotten from file chooser (python)</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/how-to-get-file-id-file-size-metadata-using-filename-gotten-from/m-p/231902#M12648</link>
      <description>&lt;P&gt;Thanks! I see two things that will likely make this not work:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1) The `files` variable given to your `success` callback is an array of files, so you can't directly access the information about specific files on it. You'll need to either iterate over it, or access individual items, e.g., `files[0].id`.&lt;/P&gt;
&lt;P&gt;2) You're never actually setting `fileids`. You're instead setting `fileicons` twice.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jul 2017 15:24:16 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/how-to-get-file-id-file-size-metadata-using-filename-gotten-from/m-p/231902#M12648</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2017-07-12T15:24:16Z</dc:date>
    </item>
    <item>
      <title>Re: how to get file_id, file_size metadata using filename gotten from file chooser (python)</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/how-to-get-file-id-file-size-metadata-using-filename-gotten-from/m-p/231973#M12654</link>
      <description>&lt;P&gt;Good catch. &amp;nbsp;I tried using var obj = files[0]; to get the first file and I was able to get the fileid. &amp;nbsp;But the filesize is still empty. &amp;nbsp;Is it possible to get filesize here? &amp;nbsp;Maybe I can get it later using fileid.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am trying to find instructions on getting metadata using fileid in python. program. &amp;nbsp;You are so knowledgable, do you have any hints for me? &amp;nbsp;I cannot pin point any good reads on it. &amp;nbsp; Thanks again.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Q&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jul 2017 05:21:13 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/how-to-get-file-id-file-size-metadata-using-filename-gotten-from/m-p/231973#M12654</guid>
      <dc:creator>app5000</dc:creator>
      <dc:date>2017-07-13T05:21:13Z</dc:date>
    </item>
    <item>
      <title>Re: how to get file_id, file_size metadata using filename gotten from file chooser (python)</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/how-to-get-file-id-file-size-metadata-using-filename-gotten-from/m-p/232057#M12656</link>
      <description>&lt;P&gt;I just took another look at your code, and I see you're trying to access the `size` returned by the Chooser, but per &lt;A href="https://www.dropbox.com/developers/chooser" target="_self"&gt;the documentation&lt;/A&gt;&amp;nbsp;that should actually be `bytes`, so you can access it like `obj[0].bytes`.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The API v2 Python SDK's &lt;A href="https://dropbox-sdk-python.readthedocs.io/en/latest/moduledoc.html#dropbox.dropbox.Dropbox.files_get_metadata" target="_self"&gt;files_get_metadata&lt;/A&gt;&amp;nbsp;method does accept a file ID in place of a path, so you can just call `dbx.files_get_metadata(fileID)`, where `fileID` is the file ID you got from the Chooser as `obj[0].id)`.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jul 2017 15:48:33 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/how-to-get-file-id-file-size-metadata-using-filename-gotten-from/m-p/232057#M12656</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2017-07-13T15:48:33Z</dc:date>
    </item>
    <item>
      <title>Re: how to get file_id, file_size metadata using filename gotten from file chooser (python)</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/how-to-get-file-id-file-size-metadata-using-filename-gotten-from/m-p/232426#M12671</link>
      <description>&lt;P&gt;Thank you so much. &amp;nbsp;You have been really helpful. &amp;nbsp;I am able to get all the metadata I was looking for. &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Q&lt;/P&gt;</description>
      <pubDate>Sun, 16 Jul 2017 01:40:31 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/how-to-get-file-id-file-size-metadata-using-filename-gotten-from/m-p/232426#M12671</guid>
      <dc:creator>app5000</dc:creator>
      <dc:date>2017-07-16T01:40:31Z</dc:date>
    </item>
  </channel>
</rss>

