By admin , 28 February, 2023 Download files from array of links, create File entities and attach them to node $files = []; $index = 1; foreach ($pictures as $picture) { $filename = 'image_' . $offer_id . '_' . $index . '.jpg'; $destination = 'sites/default/files/product-photos/' . Tags node file guzzle
By admin , 24 February, 2023 Inject Guzzle httpClient use GuzzleHttp\ClientInterface; /** * An http client. * * @var \GuzzleHttp\ClientInterface */ protected $httpClient; /** * The form constructor. * * @param \GuzzleHttp\ClientInterface $http_client * Guzzle client interface. */ public Tags dependency injection guzzle
By admin , 24 February, 2023 Download file with Guzzle $external_file = 'https://www.example.com/test.png' $destination = 'sites/default/files/test.png'; $response = \Drupal::httpClient()->get($external_file, ['sink' => $destination]); Tags guzzle