Do you want to set the dynamic name of the folder in the flowFactoryProvider configuration to transfer it to the upload.php file to save the downloaded file in it

I use this ng-flow plugin to download a zip file and it works properly. I need to pass dynamic values ​​(user_id, job_id) in it to create dynamic folders where the files will be saved, but this plugin uses the config method to initialize, and I don't get a way to pass the dynamic value in configuration mode

below are the codes that I used

view part - index.html

server side - upload.php

- app.js , here you will find a configuration function in which I want to transfer dynamic values ​​of the server side. In the Config method, I tried to determine the provider for access to dynamic values, but I could not find a way. Is there a way to access the values ​​in config (the values ​​I want to get are in the localstorageService plugin)

Hope I explained it clearly to you. Any help or suggestion would be appreciated Thanks in advance

+4
source share
2 answers

In your index.html file, add and initialize the value:

<div ng-controller="dataCtrl">
     <input ng-init="id=2374897289345" type="hidden"/>
</div>

Then open the app.js application and add a controller with the following code:

.controller('dataCtrl', ['$scope', function($scope){
    console.log('Hello');
    $scope.$on('flow::fileAdded', function (event, $flow, flowFile) {       
        $flow.opts.query = {id:$scope.id};
    });

}])

Now you can access your file in the message.

+3

, .

init

  <div flow-init = "{
                                target: '../../dummy.php',
                                permanentErrors: [404, 500, 501],
                                maxChunkRetries: 1,
                                chunkRetryInterval: 5000,
                                simultaneousUploads: 4,
                                headers: config
                  };"> 

config

$scope.config = {
        id: localStorageService.get('userkey').id, 
        token: localStorageService.get('userkey').token
  };

(localStorageService )

, $_SERVER

$_SERVER['HTTP_ID'];
$_SERVER['HTTP_TOKEN'];
+2

All Articles