Navigation

    APPDRAG Community

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Popular
    1. Home
    2. Hamza HAMZAOUI
    H
    • Profile
    • Following 0
    • Followers 0
    • Topics 1
    • Posts 8
    • Best 0
    • Groups 0

    Hamza HAMZAOUI

    @Hamza HAMZAOUI

    0
    Reputation
    1
    Profile views
    8
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    Hamza HAMZAOUI Unfollow Follow

    Latest posts made by Hamza HAMZAOUI

    • RE: fileSaveUploaded issue (appdrag-cloudbackend node package)

      @joseph-benguira Works like a charm ! Thanks !

      (should I close the topic or something 😮 ?)

      posted in Cloud Backend (Cloud DB
      H
      Hamza HAMZAOUI
    • RE: fileSaveUploaded issue (appdrag-cloudbackend node package)

      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 🙂

      posted in Cloud Backend (Cloud DB
      H
      Hamza HAMZAOUI
    • RE: fileSaveUploaded issue (appdrag-cloudbackend node package)

      @joseph-benguira Hi ! Thanks for taking time to answer me 🙂

      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).
      The whole await & async things where just desperate attempts from me to post something else to the database than a whole promise object 😢 ...

      Well wait, i'll try again with your exact syntax replacing with my things and get back to here ...

      posted in Cloud Backend (Cloud DB
      H
      Hamza HAMZAOUI
    • RE: fileSaveUploaded issue (appdrag-cloudbackend node package)

      Up 😕 ?

      posted in Cloud Backend (Cloud DB
      H
      Hamza HAMZAOUI
    • RE: fileSaveUploaded issue (appdrag-cloudbackend node package)

      (the actual console.log content)

      {"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"}
      
      posted in Cloud Backend (Cloud DB
      H
      Hamza HAMZAOUI
    • RE: fileSaveUploaded issue (appdrag-cloudbackend node package)

      @jbenguira Thx for your assistance, I now understand how the event FILES works.

      I'm actually facing a new problem and I still didn't find a solution...
      I'm trying to extract the cdnPath result from the promise that is generated throught the use of the fileSaveUploaded function.

      I tried multiple methods :

      var Myentry = await appdrag.fileSaveUploaded(event["FILES"][0]["path"], "XX-" + MyFormEntry + "_" + AnotherFormEntry + extension).then(
              async function(response) {
                  answer = await response;
                  console.log(answer);
              }
          );
      

      (This is the last one i tried)

      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.

      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 ?

      Thanks in advance.

      posted in Cloud Backend (Cloud DB
      H
      Hamza HAMZAOUI
    • RE: fileSaveUploaded issue (appdrag-cloudbackend node package)

      @jbenguira Thanks for the answer 🙂

      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 ?

      posted in Cloud Backend (Cloud DB
      H
      Hamza HAMZAOUI
    • fileSaveUploaded issue (appdrag-cloudbackend node package)

      Hi there 🙂

      I recently tried using the fileSaveUploaded method to rename files that are sent to the server throught a form.

      I managed a way to work it out throught it, but the problem is that it sounds like it works only for input events named "FILES", I didn't find a way to make it works with events of other names (it actually give a response as it can't find the parameter 0 of an undefined list)... 😞

      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 single form with multiple file upload inputs 🤔, of in other words, can I use my custom events names for this function to work proprely ?

      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

      {"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
      
      
      posted in Cloud Backend (Cloud DB
      H
      Hamza HAMZAOUI