Jump to content

[solved] Problem with uploading media - SyntaxError: Unexpected token


Recommended Posts

Hello,

 

Was wondering if anyone ever had the following problem.

 

I opened a random CMS page (for example: About us) and went ahead to insert an image through the editor.

I can see the popup and i can upload, but as soon as the upload is finished it says the following:

 

SyntaxError: Unexpected token :

 

The strange thing is that when i refresh the folder, the image did upload correctly, but why am i getting this error?

 

More importantly, how can i fix this?

 

 

From the default installation i did install another theme

(http://www.prestasho...sive-theme-15x/)

 

But surely installing a theme would not affect uploading an image..... right?

 

Thanks in advance

Edited by John_John (see edit history)
Link to comment
Share on other sites

Thanks for your reply Pascal.

 

I tried Firefox and Chrome now and did get some more info in Firefox.

It says " SyntaxError: missing } after property list "

 

Based on this, i searched on Google and found something similar

http://forge.prestas...owse/PSCFV-7564

 

Its solved by the way, but only with a slight modification based on the URL above

 

It states to change

 

search in the ajax_file_upload.php in admin/ajaxfilemanager directory

~~ line 54

$ manager = new Manager ($ upload-> GetFilePath (), false);

Change in:

$ manager = new Manager (dirname ($ upload-> GetFilePath ()), false);

 

But the correct line should be (with removal of certain spaces)

 

$manager = new Manager (dirname ($upload->getFilePath()), false);

Edited by John_John (see edit history)
  • Like 1
Link to comment
Share on other sites

  • 1 year later...

This also happened to me but in my case the solution was simple: log in again.

 

To reproduce this "problem" you have to log into back office, go to product page -> images. After this, change your internet connection to a different one, wireless in my case, and try uploading a picture. You'll get the syntax error message because your admin session is no longer valid (different IP, etc.) and ajax_file_upload.php is redirecting you to login page wich is not a valid answer for the javascript script.

 

Nothing wrong with ajax uploader in my case. Respect.

Link to comment
Share on other sites

  • 2 months later...

Got same error on images upload process at PS 1.6.0.9 when moved deployed site to new server (Ubuntu 14.04 x64 at amazon AWS EC2 Cloud).

That issue fixed easily with info provided by Apache err log - missed php-gd library found there!

$ sudo apt-get install php5-gd 

and we are again friends)

If it is possible to add test  on all needed library presence at BO AdminInformation Controller, that will get a great convenience to all Prestashop  movers!

 

Sincerely Yours,

Vic 

Edited by MrTor (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...