Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NEW] upload media to order #153

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

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()

@@ -87,6 +87,36 @@


?>
<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