2017-11-07 2 views
0

Ich verwende Filestack (aka filepicker.io) in meiner Angular 4 App. Wenn ich eine Datei auswähle (und vor dem Hochladen), wird sie automatisch hochgeladen. Also, nachdem ich hochladen, habe ich 2 Dateien hochgeladen. Was mache ich falsch? :(Filepicker.io (Filestack) lädt zweimal hoch

dies ist mein Code:.

async showPicker() { 

    const client = filestack.init('MyApiKey'); 

    const result = await client.pick({ 
     fromSources: ['local_file_system', 'webcam', 'imagesearch', 'facebook', 'instagram', 'googledrive', 'dropbox', 'picasa'], 
     maxFiles: 1, 
     minFiles: 1, 
     transformations: { 
      crop: { 
       force: true, 
       aspectRatio: 1 
      } 
     }, 
     accept: ['image/*'] 
    }); 

    const url = result.filesUploaded[0].url; 
    this.uploadedFileUrls.push(url); 
} 

PS Ich habe bereits diese Filestack with Angular 2

Antwort

1

Zur Zeit der Parameter uploadInBackground wird auf 'true' standardmäßig eingestellt werden, die Hintergrund-Upload ermöglicht Wenn Sie Möchten Sie dies deaktivieren, fügen Sie einfach den Parametersatz uploadInBackground wie folgt in den Code false ein:

async showPicker() { 
 

 
    const client = filestack.init('MyApiKey'); 
 

 
    const result = await client.pick({ 
 
     fromSources: ['local_file_system', 'webcam', 'imagesearch', 'facebook', 'instagram', 'googledrive', 'dropbox', 'picasa'], 
 
     maxFiles: 1, 
 
     minFiles: 1, 
 
     uploadInBackground: false, 
 
     transformations: { 
 
      crop: { 
 
       force: true, 
 
       aspectRatio: 1 
 
      } 
 
     }, 
 
     accept: ['image/*'] 
 
    }); 
 

 
    const url = result.filesUploaded[0].url; 
 
    this.uploadedFileUrls.push(url); 
 
}

Verwandte Themen