javascript Magento UploaderJsObject 未定义
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13030205/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Magento UploaderJsObject is not defined
提问by Weszzz7
I encountered a very weird error which i can't seem to solve. Anywhere in the admin area where i want to upload/view/delete images nothing is showing up.
我遇到了一个非常奇怪的错误,我似乎无法解决。在我想要上传/查看/删除图像的管理区域中的任何地方都没有显示任何内容。
My 'inspect element' console gives me this error:
我的“检查元素”控制台给了我这个错误:
Uncaught ReferenceError: id_23b2a41c446dee70b327b51065e06137_UploaderJsObject is not defined
I tracked this down to the gallery.phtml file which has this code:
我将其跟踪到具有以下代码的 gallery.phtml 文件:
<script type="text/javascript">
//<![CDATA[
var <?php echo $_block->getJsObjectName(); ?> = new Product.Gallery('<?php echo $_block->getHtmlId() ?>', <?php if ($_block->getElement()->getReadonly()):?>null<?php else:?><?php echo $_block->getUploader()->getJsObjectName() ?><?php endif;?>, <?php echo $_block->getImageTypesJson() ?>);
//]]>
</script>
I have absolutely no clue what went wrong here. I haven't messes with any core files. Nor did i change any javascript things.
我完全不知道这里出了什么问题。我没有弄乱任何核心文件。我也没有改变任何 javascript 的东西。
I'm hoping someone can help me find out what is wrong. Been stuck on this error since yesterday..
我希望有人能帮我找出问题所在。从昨天开始就被这个错误卡住了..
Any help is appreciated :)
任何帮助表示赞赏:)
回答by Danny Z
Recently cloned a repo or trying to set up another magento environment and seeing this error? check to see if the following files are in their proper places that may have been left behind due to being binary file (swf flash file) or ignored by version control software:
最近克隆了一个 repo 或尝试设置另一个 magento 环境并看到此错误?检查以下文件是否位于适当的位置,这些文件可能由于是二进制文件(swf flash 文件)或被版本控制软件忽略而被遗留下来:
/skin/adminhtml/default/default/media/uploader.swf
/skin/adminhtml/default/default/media/uploaderSingle.swf
/skin/adminhtml/default/default/media/editor.swf
/skin/adminhtml/default/default/media/flex.swf
and for good measure these files:
并且为了更好地衡量这些文件:
/app/design/adminhtml/default/default/template/media/uploader.phtml
/app/design/adminhtml/default/default/template/media/editor.phtml
And someone below was kind to mention as of magento 1.9:
从 magento 1.9 开始,下面有人友好地提到:
/skin/adminhtml/default/default/media/editor.swf
does not exist, so don't worry about that file.
不存在,所以不用担心那个文件。
回答by Ronnie Hyslop
I had the same problem.
我有同样的问题。
In my php.ini the max_post was set to 0 which should disable it, however this breaks the JS Uploader as it queries php's max upload size.
在我的 php.ini 中,max_post 设置为 0 应该禁用它,但是这会破坏 JS Uploader,因为它查询 php 的最大上传大小。
I Just set it to 100M and the browse and upload buttons appeared.
我只是将其设置为 100M 并出现浏览和上传按钮。
回答by Meetai.com
In my case, removing the file Dull_Uploader.xml
from /app/etc/modules
solved this specific problem.
在我的情况下,删除文件Dull_Uploader.xml
从/app/etc/modules
解决特定问题。
回答by Adarsh Khatri
I checked everything that is given in this page and all files are in right place. Further investigating took me to this page.
我检查了此页面中给出的所有内容,所有文件都在正确的位置。进一步调查将我带到此页面。
Then I realize I am in firefox, and that could be the reason.
然后我意识到我在 Firefox 中,这可能是原因。
After installing flash player it all working fine.
安装 Flash Player 后一切正常。
Hope this will help someone.
希望这会帮助某人。
Update -1 (in case ref link changes):
更新 -1(以防参考链接发生变化):
Check for the flash player
http://helpx.adobe.com/flash-player.html
Your magento root directory should not be password protected using .htpasswd file.
Please post if you are getting any error.
回答by dovid
The answer given be @danny-z seems to have done the trick.
@danny-z 给出的答案似乎已经做到了。
I'd like to also add that the permissions of all of those files should be set to 0644. So simply cd
into each of those directories and check the current permissions using ls -l
. They should appear as -rw-r--r--
. If they do not then do chmod 0644 *
(make sure you are inside the directory when running this so it only affects those files) and then check them again to make sure it worked.
我还想补充一点,所有这些文件的权限都应该设置为 0644。所以只需cd
进入每个目录并使用ls -l
. 它们应该显示为-rw-r--r--
. 如果他们不这样做chmod 0644 *
(确保在运行时您在目录中,这样它只会影响那些文件),然后再次检查它们以确保它有效。
Also, @KPheasey mentions above in a comment that .gitignore
was excluding all media
. I understand that to mean that when deploying the site to the server all media
was excluded because of the .gitignore
, but having media
in .gitignore
locally will not prevent those files from working locally. Just wanted to clarify because I was a bit confused at first by that comment.
此外,@KPheasey 在.gitignore
排除所有media
. 我理解这意味着当将站点部署到服务器时,所有内容都media
被排除在外.gitignore
,但media
在.gitignore
本地不会阻止这些文件在本地工作。只是想澄清一下,因为一开始我对那个评论有点困惑。
The reason the files were missing for me was because I did a tar
of an existing website (to set up on my local machine) and excluded media
so that I did not get a huge file. I meant to exclude the main media
folder, but by mistake excluded these as well (and perhaps others I guess).
这些文件对我来说丢失的原因是因为我做了tar
一个现有网站(在我的本地机器上设置)并排除在外,media
所以我没有得到一个大文件。我的意思是排除主media
文件夹,但错误地排除了这些(我猜可能还有其他文件夹)。
回答by shemaya
At last I got it resolved by installing flash on my ubuntu 16.04:
最后我通过在 ubuntu 16.04 上安装 flash 解决了这个问题:
sudo apt install adobe-flashplugin
回答by Weszzz7
Oke, wow my collegae just found it a second after posting this question.
好吧,哇,我的大学在发布这个问题后一秒钟就找到了。
If anyone else has this problem.
如果其他人有这个问题。
Somehow certain files in the skin folder went missing.
不知何故,皮肤文件夹中的某些文件丢失了。
Hope someone will find this information useful.
希望有人会发现这些信息有用。