0

I have tried to upload images for the different variations as like below with generating media_id in laravel.

str_replace('-', '', Str::uuid()->toString());

The above code is creating a random string and with the help of that some of the images are uploading but some are not.

$urlArr = array('url' => $url);
$parts = pathinfo($url); 
$params = array('extension' => $parts['extension'],'fileName' => $parts['filename'] . '__' . md5(time()),);


$uploadImage = $shopware6HelperObj->post('_action/media/' . $mediaId . '/upload', $urlArr, $params, $accessToken);

Above is the process of upload variation images but somehow some of the products of variations are uploading while some are not.

Can you please suggest where is the issue and lake in the code?

James Z
  • 12,209
  • 10
  • 24
  • 44
Yogesh
  • 289
  • 4
  • 13
  • Did you try to check the response of Shopware API? May you will find an answer there. E.g. File type is not supported or something else. – Valerio8787 Sep 27 '21 at 09:24
  • Same file type where some of them are imported. – Yogesh Sep 27 '21 at 09:36
  • It was just an example. Did you get any error in the response or it is always 200? – Valerio8787 Sep 27 '21 at 11:58
  • A common error might be that some of the images are bigger than the servers maximum upload size / post size. See https://stackoverflow.com/questions/2184513/change-the-maximum-upload-file-size – Alex Sep 27 '21 at 17:01

0 Answers0