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

Uncaught SyntaxError: Unexpected token i #40

Closed
yannskee opened this issue Apr 12, 2015 · 4 comments
Closed

Uncaught SyntaxError: Unexpected token i #40

yannskee opened this issue Apr 12, 2015 · 4 comments

Comments

@yannskee
Copy link

Hello i having this problem: "Uncaught SyntaxError: Unexpected token i" when I click on the "Edit" button where I included the image widget in my view.

I use the branch : "comur/image-bundle": "1.0.*@dev"
and bootstrap 3.

In my layout I used {% include "ComurImageBundle:Form:croppable_image_modal.html.twig" with {'include_jquery': false, 'include_bootstrap': false} %} since i'm already including a jquery script and bootstrap 3. I made sure the include was after the jquery script.

When i click on the error msg in the navigator console. i don't get a specific line number, so i have no idea where the error is coming from.

@yannskee
Copy link
Author

I found the source of the problem. The issue is caused because I am using windows and the path generated by this :
public function getUploadRootDir()
{
// absolute path to your directory where images must be saved
return DIR.'/../../../../../web/'.$this->getUploadDir();
}
has backslashes instead of foward slash on Linux. So there is a conflict with Javascript and JSON.

This seemed to have fixed the issue:

public function getUploadRootDir()
{
    // absolute path to your directory where images must be saved
    return str_replace('\\', '\\\\', __DIR__.'/../../../../web/'.$this->getUploadDir());
}

@najiboulhouch
Copy link

thanks yannskee it work with me .

@ignasdamunskis
Copy link

I had the same problem. Please update documentation. It took me some time to find an answer. Thank you yannskee!

@comur
Copy link
Owner

comur commented May 30, 2019

It’s not necessary now since someone sent a PR for this problem. I close it

@comur comur closed this as completed May 30, 2019
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

No branches or pull requests

4 participants