Skip to content

[NEW] upload media to order#153

Open
WLsupport wants to merge 5 commits intoaimeos:masterfrom
WLsupport:features/upload_images_to_order
Open

[NEW] upload media to order#153
WLsupport wants to merge 5 commits intoaimeos:masterfrom
WLsupport:features/upload_images_to_order

Conversation

@WLsupport
Copy link

No description provided.

@aimeos
Copy link
Owner

aimeos commented Aug 31, 2021

Thanks, but your code contains a lot of commented code and Laravel specific code as well as changed files not related to the feature. Can you clean up your PR first?

<div class="upload-wrapper">
<div class="upload-view"
data-title="<?= $enc->html( $this->translate( 'client/code', $attribute->getName() ) ) ?>"
onclick="document.querySelector('#upload-<?= $enc->attr( $this->productItem->getId() . '-' . $key ) ?>').click()"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No inline JS please because this won't work because of Content Security Policy rules

$fs->writes($filepath, $stream);
fclose($stream);
} catch (\Exception $ex) {
Log::error($ex->getMessage());
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Log::error() is also Laravel specific. Use $this->getContext()->logger()->log() instead

foreach ($entries[$i]['attrcustid'][$attrId] as $file) {
$filepath = 'basket-upload/' . md5($file->getFilename() . microtime(true)) . '.' . $file->extension();
try {
$stream = fopen($file->getRealPath(), 'r+');
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check return value of fopen()



?>
<script type="text/javascript">
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inline JS doesn't work with CSP and must be moved to the JS file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants