<?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 How to handle temporary files that are created by uploading files? in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/How-to-handle-temporary-files-that-are-created-by-uploading/m-p/439271#M23134</link>
    <description>&lt;P&gt;Sort of new to web dev in general so forgive me if I don't know what to do. The issue is that in my local project repository. Temporary files are being created. I'm not sure if this is an issue to be concerned with? I worry what will happen after deployment and whether this will cause issues down the line. Are we suppose to just let the host clean the files automatically or are suppose to manually flush the temporary files created after file upload? I plan to deploy on Heroku for my web app.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Dropbox file upload.png" style="width: 785px;"&gt;&lt;img src="https://www.dropboxforum.com/t5/image/serverpage/image-id/16899i9DE949B912FFFB01/image-size/large?v=v2&amp;amp;px=999" role="button" title="Dropbox file upload.png" alt="Dropbox file upload.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is some code to let you know what is going on. I'm using the Dropbox SDK for Javascript.&lt;/P&gt;
&lt;P&gt;Express -&amp;gt; using Formidable / Form as middleware to parse request.&lt;/P&gt;
&lt;PRE&gt;app.post('/form', (req,res)=&amp;gt;{
		let success = null;
		//take the file and send it off to dropbox
		form.parse(req, (err, fields, files) =&amp;gt; {
			console.log("fields:", fields);
			console.log("file:", files.myfile);
			console.log('filename:', files.myfile.name);
			// if (files.myfile.size &amp;gt; const UPLOAD_FILE_SIZE_LIMIT) 
			if (files.myfile.size&amp;lt;UPLOAD_FILE_SIZE_LIMIT) {
				dbx.filesUpload({path: "/ReflectionsBucket/" + files.myfile.name, contents: files.myfile, autorename: true})
				.then(res=&amp;gt;console.log(res))
				.catch(err=&amp;gt;console.log(err));
				success=true;
			} else {
				success=false;
			}
				
		}); //form.parse

		//need to add the event when the form ends using form.on('end')

		form.on('end', ()=&amp;gt;{
			if (success)  res.send('post successful');
			else res.send('file size is too big, needs to be under 150mb');
		});

		

	});&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 22 Jul 2020 06:42:27 GMT</pubDate>
    <dc:creator>redrezo11</dc:creator>
    <dc:date>2020-07-22T06:42:27Z</dc:date>
    <item>
      <title>How to handle temporary files that are created by uploading files?</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/How-to-handle-temporary-files-that-are-created-by-uploading/m-p/439271#M23134</link>
      <description>&lt;P&gt;Sort of new to web dev in general so forgive me if I don't know what to do. The issue is that in my local project repository. Temporary files are being created. I'm not sure if this is an issue to be concerned with? I worry what will happen after deployment and whether this will cause issues down the line. Are we suppose to just let the host clean the files automatically or are suppose to manually flush the temporary files created after file upload? I plan to deploy on Heroku for my web app.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Dropbox file upload.png" style="width: 785px;"&gt;&lt;img src="https://www.dropboxforum.com/t5/image/serverpage/image-id/16899i9DE949B912FFFB01/image-size/large?v=v2&amp;amp;px=999" role="button" title="Dropbox file upload.png" alt="Dropbox file upload.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is some code to let you know what is going on. I'm using the Dropbox SDK for Javascript.&lt;/P&gt;
&lt;P&gt;Express -&amp;gt; using Formidable / Form as middleware to parse request.&lt;/P&gt;
&lt;PRE&gt;app.post('/form', (req,res)=&amp;gt;{
		let success = null;
		//take the file and send it off to dropbox
		form.parse(req, (err, fields, files) =&amp;gt; {
			console.log("fields:", fields);
			console.log("file:", files.myfile);
			console.log('filename:', files.myfile.name);
			// if (files.myfile.size &amp;gt; const UPLOAD_FILE_SIZE_LIMIT) 
			if (files.myfile.size&amp;lt;UPLOAD_FILE_SIZE_LIMIT) {
				dbx.filesUpload({path: "/ReflectionsBucket/" + files.myfile.name, contents: files.myfile, autorename: true})
				.then(res=&amp;gt;console.log(res))
				.catch(err=&amp;gt;console.log(err));
				success=true;
			} else {
				success=false;
			}
				
		}); //form.parse

		//need to add the event when the form ends using form.on('end')

		form.on('end', ()=&amp;gt;{
			if (success)  res.send('post successful');
			else res.send('file size is too big, needs to be under 150mb');
		});

		

	});&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jul 2020 06:42:27 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/How-to-handle-temporary-files-that-are-created-by-uploading/m-p/439271#M23134</guid>
      <dc:creator>redrezo11</dc:creator>
      <dc:date>2020-07-22T06:42:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to handle temporary files that are created by uploading files?</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/How-to-handle-temporary-files-that-are-created-by-uploading/m-p/439496#M23135</link>
      <description>&lt;P&gt;I'm afraid we can't be of much help with this unfortunately, as it doesn't seem these files are being produced by&amp;nbsp;Dropbox code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The&amp;nbsp;Dropbox JavaScript SDK is open source, so you can see what it's doing at the following locations in the code for the 'filesUpload' method you're using, for instance:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;A href="https://github.com/dropbox/dropbox-sdk-js/blob/f87aad93834fe3f3d78de45f15fdef1b38dc59ad/src/routes.js#L1165" target="_self"&gt;https://github.com/dropbox/dropbox-sdk-js/blob/f87aad93834fe3f3d78de45f15fdef1b38dc59ad/src/routes.js#L1165&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;A href="https://github.com/dropbox/dropbox-sdk-js/blob/f87aad93834fe3f3d78de45f15fdef1b38dc59ad/src/dropbox-base.js#L534" target="_self"&gt;https://github.com/dropbox/dropbox-sdk-js/blob/f87aad93834fe3f3d78de45f15fdef1b38dc59ad/src/dropbox-base.js#L534&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;A href="https://github.com/dropbox/dropbox-sdk-js/blob/f87aad93834fe3f3d78de45f15fdef1b38dc59ad/src/dropbox-base.js#L585" target="_self"&gt;https://github.com/dropbox/dropbox-sdk-js/blob/f87aad93834fe3f3d78de45f15fdef1b38dc59ad/src/dropbox-base.js#L585&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;A href="https://github.com/dropbox/dropbox-sdk-js/blob/f87aad93834fe3f3d78de45f15fdef1b38dc59ad/src/upload-request.js#L12" target="_self"&gt;https://github.com/dropbox/dropbox-sdk-js/blob/f87aad93834fe3f3d78de45f15fdef1b38dc59ad/src/upload-request.js#L12&lt;/A&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;The method just uploads whatever content you supply to that 'contents' parameter.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Perhaps the files are produced by your web framework itself, for the files posted in that form to begin with? In that case, I'd&amp;nbsp;recommend referring to the documentation/support for that framework.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jul 2020 15:54:11 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/How-to-handle-temporary-files-that-are-created-by-uploading/m-p/439496#M23135</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2020-07-22T15:54:11Z</dc:date>
    </item>
  </channel>
</rss>

