<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[fileSaveUploaded issue (appdrag-cloudbackend node package)]]></title><description><![CDATA[<p dir="auto">Hi there <img src="https://community.appdrag.com/plugins/nodebb-plugin-emoji/emoji/android/1f642.png?v=lfk1vimvd74" class="not-responsive emoji emoji-android emoji--slightly_smiling_face" title=":)" alt="🙂" /></p>
<p dir="auto">I recently tried using the <strong>fileSaveUploaded</strong> method to <strong>rename files</strong> that are sent to the server throught a <strong>form</strong>.</p>
<p dir="auto">I managed a way to work it out throught it, but the problem is that it sounds like it works <strong>only</strong> for input <strong>events named "FILES"</strong>, I didn't find a way to make it works with events of other names <em>(it actually give a response as it can't find the parameter 0 of an undefined list)</em>... <img src="https://community.appdrag.com/plugins/nodebb-plugin-emoji/emoji/android/1f61e.png?v=lfk1vimvd74" class="not-responsive emoji emoji-android emoji--disappointed" title=":(" alt="😞" /></p>
<p dir="auto">I feel like we should use multi_input file upload element to navigate on files inside the event, but I really need to know if there is a way to make it work on a <strong>single form</strong> with <strong>multiple file upload inputs</strong> <img src="https://community.appdrag.com/plugins/nodebb-plugin-emoji/emoji/android/1f914.png?v=lfk1vimvd74" class="not-responsive emoji emoji-android emoji--thinking_face" title=":thinking_face:" alt="🤔" />, of in other words, can I use my <strong>custom events names</strong> for this function to work proprely ?</p>
<p dir="auto"><em>for curious people : error stack of the case the event name isn't "FILES" but should still be pointing a valid input on the page</em></p>
<pre><code>{"status":"OK","execTime":1256,"billedTime":1300,"payload":{"errorType":"TypeError","errorMessage":"Cannot read property '0' of undefined","trace":["TypeError: Cannot read property '0' of undefined","    at Runtime.exports.handler (/var/task/main.js:49:49)","    at Runtime.handleOnce (/var/runtime/Runtime.js:66:25)"]},"logs":"2021-07-22T13:56:19.821Z\teb22f29d-aa34-41a4-af7f-33a2bbf46435\tERROR\tInvoke Error \t{\"errorType\":\"TypeError\",\"errorMessage\":\"Cannot read property '0' of undefined\",\"stack\":[\"TypeError: Cannot read property '0' of undefined\",\"    at Runtime.exports.handler (/var/task/main.js:49:49)\",\"    at Runtime.handleOnce (/var/runtime/Runtime.js:66:25)\"]}\n"} appdrag.js:1:1119

</code></pre>
]]></description><link>https://community.appdrag.com/topic/914/filesaveuploaded-issue-appdrag-cloudbackend-node-package</link><generator>RSS for Node</generator><lastBuildDate>Tue, 21 Apr 2026 14:17:20 GMT</lastBuildDate><atom:link href="https://community.appdrag.com/topic/914.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 22 Jul 2021 14:27:40 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to fileSaveUploaded issue (appdrag-cloudbackend node package) on Sun, 01 Aug 2021 10:01:45 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.appdrag.com/uid/781">@undefined</a> Done, marked as solved <img src="https://community.appdrag.com/plugins/nodebb-plugin-emoji/emoji/android/1f609.png?v=lfk1vimvd74" class="not-responsive emoji emoji-android emoji--wink" title=";)" alt="😉" /></p>
]]></description><link>https://community.appdrag.com/post/3744</link><guid isPermaLink="true">https://community.appdrag.com/post/3744</guid><dc:creator><![CDATA[Joseph Benguira]]></dc:creator><pubDate>Sun, 01 Aug 2021 10:01:45 GMT</pubDate></item><item><title><![CDATA[Reply to fileSaveUploaded issue (appdrag-cloudbackend node package) on Fri, 30 Jul 2021 11:41:37 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.appdrag.com/uid/16">@joseph-benguira</a> Works like a charm ! Thanks !</p>
<p dir="auto">(should I close the topic or something <img src="https://community.appdrag.com/plugins/nodebb-plugin-emoji/emoji/android/1f62e.png?v=lfk1vimvd74" class="not-responsive emoji emoji-android emoji--open_mouth" title=":O" alt="😮" /> ?)</p>
]]></description><link>https://community.appdrag.com/post/3740</link><guid isPermaLink="true">https://community.appdrag.com/post/3740</guid><dc:creator><![CDATA[Hamza HAMZAOUI]]></dc:creator><pubDate>Fri, 30 Jul 2021 11:41:37 GMT</pubDate></item><item><title><![CDATA[Reply to fileSaveUploaded issue (appdrag-cloudbackend node package) on Fri, 30 Jul 2021 10:35:39 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.appdrag.com/uid/781">@undefined</a> I have quickly checked one project where I did this and here is the code:</p>
<pre><code>if (event.FILES.length &gt; 0) {
        file = JSON.parse(await appdrag.fileSaveUploaded( event["FILES"][0]["path"], `myfolder/${event["FILES"][0]["path"].split('/')[1]}`))['cdnPath'];
    }
</code></pre>
<p dir="auto">so here the thing is you indeed need to await before calling appdrag.fileSaveUploaded, and also you need to parse the response as JSON, then you can access the field cdnPath <img src="https://community.appdrag.com/plugins/nodebb-plugin-emoji/emoji/android/1f609.png?v=lfk1vimvd74" class="not-responsive emoji emoji-android emoji--wink" title=";)" alt="😉" /></p>
]]></description><link>https://community.appdrag.com/post/3737</link><guid isPermaLink="true">https://community.appdrag.com/post/3737</guid><dc:creator><![CDATA[Joseph Benguira]]></dc:creator><pubDate>Fri, 30 Jul 2021 10:35:39 GMT</pubDate></item><item><title><![CDATA[Reply to fileSaveUploaded issue (appdrag-cloudbackend node package) on Fri, 30 Jul 2021 07:46:50 GMT]]></title><description><![CDATA[<p dir="auto">Same problem, it stores the whole object instead of the specific url, didn't find a way to deal with it after few attempts, if somebody has another solution I would love to hear from it <img src="https://community.appdrag.com/plugins/nodebb-plugin-emoji/emoji/android/1f642.png?v=lfk1vimvd74" class="not-responsive emoji emoji-android emoji--slightly_smiling_face" title=":)" alt="🙂" /></p>
]]></description><link>https://community.appdrag.com/post/3736</link><guid isPermaLink="true">https://community.appdrag.com/post/3736</guid><dc:creator><![CDATA[Hamza HAMZAOUI]]></dc:creator><pubDate>Fri, 30 Jul 2021 07:46:50 GMT</pubDate></item><item><title><![CDATA[Reply to fileSaveUploaded issue (appdrag-cloudbackend node package) on Thu, 29 Jul 2021 15:56:24 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.appdrag.com/uid/16">@joseph-benguira</a> Hi ! Thanks for taking time to answer me <img src="https://community.appdrag.com/plugins/nodebb-plugin-emoji/emoji/android/1f642.png?v=lfk1vimvd74" class="not-responsive emoji emoji-android emoji--slightly_smiling_face" title=":)" alt="🙂" /></p>
<p dir="auto">Well, the point is that I tried with the method you describe at first, then found out that it was sending a whole promise to the database, which can't be correctly used as an URL (direct link to the uploaded file), so I was trying to find a way to extract the cdnPath from that promise so I could get the link only, not the whole thing (The console print in my previous message shows what the console.log(response) returns to the browser).<br />
The whole await &amp; async things where just desperate attempts from me to post something else to the database than a whole promise object <img src="https://community.appdrag.com/plugins/nodebb-plugin-emoji/emoji/android/1f622.png?v=lfk1vimvd74" class="not-responsive emoji emoji-android emoji--cry" title=":'(" alt="😢" /> ...</p>
<p dir="auto">Well wait, i'll try again with your exact syntax replacing with my things and get back to here ...</p>
]]></description><link>https://community.appdrag.com/post/3732</link><guid isPermaLink="true">https://community.appdrag.com/post/3732</guid><dc:creator><![CDATA[Hamza HAMZAOUI]]></dc:creator><pubDate>Thu, 29 Jul 2021 15:56:24 GMT</pubDate></item><item><title><![CDATA[Reply to fileSaveUploaded issue (appdrag-cloudbackend node package) on Thu, 29 Jul 2021 15:27:01 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.appdrag.com/uid/781">@undefined</a> in your code you have :</p>
<p dir="auto">answer = await response;</p>
<p dir="auto">this is incorrect, you can directly do:</p>
<p dir="auto">console.log(response);</p>
<p dir="auto">also no need to have async before the inline response</p>
<pre><code>var Myentry = await appdrag.fileSaveUploaded(event["FILES"][0]["path"], "XX-" + MyFormEntry + "_" + AnotherFormEntry + extension).then(
        function(response) {
            console.log(response);
        }
    );
</code></pre>
<p dir="auto">in fact you don't need to mess at all with async/await, just this should do it</p>
<pre><code>appdrag.fileSaveUploaded(event["FILES"][0]["path"], "XX-" + MyFormEntry + "_" + AnotherFormEntry + extension).then(
        function(response) {
            console.log(response);
        }
    );
</code></pre>
]]></description><link>https://community.appdrag.com/post/3729</link><guid isPermaLink="true">https://community.appdrag.com/post/3729</guid><dc:creator><![CDATA[Joseph Benguira]]></dc:creator><pubDate>Thu, 29 Jul 2021 15:27:01 GMT</pubDate></item><item><title><![CDATA[Reply to fileSaveUploaded issue (appdrag-cloudbackend node package) on Thu, 29 Jul 2021 12:50:04 GMT]]></title><description><![CDATA[<p dir="auto">Up <img src="https://community.appdrag.com/plugins/nodebb-plugin-emoji/emoji/android/1f615.png?v=lfk1vimvd74" class="not-responsive emoji emoji-android emoji--confused" title=":confused:" alt="😕" /> ?</p>
]]></description><link>https://community.appdrag.com/post/3728</link><guid isPermaLink="true">https://community.appdrag.com/post/3728</guid><dc:creator><![CDATA[Hamza HAMZAOUI]]></dc:creator><pubDate>Thu, 29 Jul 2021 12:50:04 GMT</pubDate></item><item><title><![CDATA[Reply to fileSaveUploaded issue (appdrag-cloudbackend node package) on Tue, 27 Jul 2021 10:12:01 GMT]]></title><description><![CDATA[<p dir="auto">(the actual console.log content)</p>
<pre><code>{"status":"OK","execTime":1173,"billedTime":1200,"payload":"null","logs":"2021-07-27T09:12:59.362Z\t1d9a7104-bd32-4cd4-b39b-0c9948e8085c\tINFO\t{\"status\":\"OK\",\"directPath\":\"//someawsserver.com/dev.appdrag.com/test-****-*-******/CloudBackend/uploads/TheFirstFile.extension\",\"cdnPath\":\"//cf.appdrag.com/test-*****-*-******/CloudBackend/uploads/TheFirstFile.extension\\"}\n2021-07-27T09:12:59.577Z\t1d9a7104-bd32-4cd4-b39b-0c9948e8085c\tINFO\t{\"status\":\"OK\",\"directPath\":\"//someawsserver.com/dev.appdrag.com/test****-*-******/CloudBackend/uploads/TheSecondFile.extension\",\"cdnPath\":\"//cf.appdrag.com/test-****-*-******/CloudBackend/uploads/TheSecondFile.extension\"}\n2021-07-27T09:12:59.641Z\t1d9a7104-bd32-4cd4-b39b-0c9948e8085c\tINFO\t{ \"status\" : \"OK\", \"execTime\" : \"9\", \"billedTime\" : \"9\", \"affectedRows\" : \"1\"}\n"}
</code></pre>
]]></description><link>https://community.appdrag.com/post/3720</link><guid isPermaLink="true">https://community.appdrag.com/post/3720</guid><dc:creator><![CDATA[Hamza HAMZAOUI]]></dc:creator><pubDate>Tue, 27 Jul 2021 10:12:01 GMT</pubDate></item><item><title><![CDATA[Reply to fileSaveUploaded issue (appdrag-cloudbackend node package) on Tue, 27 Jul 2021 10:05:57 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.appdrag.com/uid/1">@jbenguira</a> Thx for your assistance, I now understand how the event FILES works.</p>
<p dir="auto">I'm actually facing a new problem and I still didn't find a solution...<br />
I'm trying to extract the cdnPath result from the promise that is generated throught the use of the  fileSaveUploaded function.</p>
<p dir="auto">I tried multiple methods :</p>
<pre><code>var Myentry = await appdrag.fileSaveUploaded(event["FILES"][0]["path"], "XX-" + MyFormEntry + "_" + AnotherFormEntry + extension).then(
        async function(response) {
            answer = await response;
            console.log(answer);
        }
    );
</code></pre>
<p dir="auto">(This is the last one i tried)</p>
<p dir="auto">The problem is that console.log returns a promise, that when pushed to the database as a "link" is replaces by [promise object], using a return only takes the first { in account and don't paste the rest, using response.cdnPath returns an undefined value.</p>
<p dir="auto">So, I'm trying to extract the cdnPath link that the function generates to post it proprely to the database, could somebody give me an advice of how to proprely grab it to POST it as a direct link ?</p>
<p dir="auto">Thanks in advance.</p>
]]></description><link>https://community.appdrag.com/post/3719</link><guid isPermaLink="true">https://community.appdrag.com/post/3719</guid><dc:creator><![CDATA[Hamza HAMZAOUI]]></dc:creator><pubDate>Tue, 27 Jul 2021 10:05:57 GMT</pubDate></item><item><title><![CDATA[Reply to fileSaveUploaded issue (appdrag-cloudbackend node package) on Sun, 25 Jul 2021 04:29:06 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.appdrag.com/uid/781">@undefined</a> that's correct <img src="https://community.appdrag.com/plugins/nodebb-plugin-emoji/emoji/android/1f642.png?v=lfk1vimvd74" class="not-responsive emoji emoji-android emoji--slightly_smiling_face" title=":)" alt="🙂" /></p>
]]></description><link>https://community.appdrag.com/post/3714</link><guid isPermaLink="true">https://community.appdrag.com/post/3714</guid><dc:creator><![CDATA[jbenguira]]></dc:creator><pubDate>Sun, 25 Jul 2021 04:29:06 GMT</pubDate></item><item><title><![CDATA[Reply to fileSaveUploaded issue (appdrag-cloudbackend node package) on Sat, 24 Jul 2021 05:05:56 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.appdrag.com/uid/1">@jbenguira</a> Thanks for the answer <img src="https://community.appdrag.com/plugins/nodebb-plugin-emoji/emoji/android/1f642.png?v=lfk1vimvd74" class="not-responsive emoji emoji-android emoji--slightly_smiling_face" title=":)" alt="🙂" /></p>
<p dir="auto">Well, does that mean that anything I upload from a single form will be appended to the event FILES ? So the name of the entry from the form could be whatever ?</p>
]]></description><link>https://community.appdrag.com/post/3713</link><guid isPermaLink="true">https://community.appdrag.com/post/3713</guid><dc:creator><![CDATA[Hamza HAMZAOUI]]></dc:creator><pubDate>Sat, 24 Jul 2021 05:05:56 GMT</pubDate></item><item><title><![CDATA[Reply to fileSaveUploaded issue (appdrag-cloudbackend node package) on Thu, 22 Jul 2021 16:32:02 GMT]]></title><description><![CDATA[<p dir="auto">@hamza-hamzaoui that's correct, uploaded files will be available in an array in event.FILES</p>
<p dir="auto">There is no way to change this but it's not an issue, your code inside your backend function just have to read that collection <img src="https://community.appdrag.com/plugins/nodebb-plugin-emoji/emoji/android/1f609.png?v=lfk1vimvd74" class="not-responsive emoji emoji-android emoji--wink" title=";)" alt="😉" /></p>
]]></description><link>https://community.appdrag.com/post/3709</link><guid isPermaLink="true">https://community.appdrag.com/post/3709</guid><dc:creator><![CDATA[jbenguira]]></dc:creator><pubDate>Thu, 22 Jul 2021 16:32:02 GMT</pubDate></item></channel></rss>