phpfilestack

store the URL of an upload in filestack into a mysql database


I've recently signed up to filestack, and I am finding it a bit difficult to understand their documentation.

I've added the javaascript plugin on to my website. However I am just wondering if you can actually store the URL of the uploaded file into a mysql database?


Solution

  • Just not sure what the next step is to actually get the URL of the file the person just uploaded

    Please take a look at this example: https://jsfiddle.net/1fLjbrwr/1/

    client.pick({
      accept: 'image/*',
    }).then(function(result) {
      // file url (plus mimetype, size and more)
      // can be found inside the result object
      console.log(result);
      console.log("File url: " + result.filesUploaded[0].url);
    });
    

    When file is uploaded, you can use a callback function to handle the response.

    You can also use one of built-in callback functions that are called at various points during the upload process (docs available here: https://www.filestack.com/docs/javascript-api/pick-v3):

    client.pick({
      accept: 'image/*',
      onFileUploadFinished: function(file) {
        // this will be called when file is uploaded
        console.log(file);
      }
    })