Jump to content

'Undefined' error when uploading a new product image Prestashop 1.5.3.1


Recommended Posts

I have v 1541

- in IE it's ok, upload ok

- in FF - not ok, hmmm

 

How to solve this problem? This: https://sites.google.com/site/zainozzaini/prestashop/undefined-image-upload-function-for-prestashop-1-5-6-1

is not correct??? not work

 

I noticed that after 15 minutes image added. But only one. Again the same.

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

The default behaviour when uploading images definitely needs to be changed in the upcoming 1.6 version. There is no way of knowing what is happening when an image is selected to be uploaded. Only way of knowing this is when the image is visible on the back office product page when successfully loaded. Images which are bigger in size take time to be uploaded and you need to wait till it appears. Not intuitive at all.

 

The behaviour can be similar to the stock updation when there is an 'updating' message which appears at the top of the page.

Link to comment
Share on other sites

  • 2 weeks later...

Guys I have the same problem.

 

Is it on prestashop itselfs or my back office (cpanelX)

 

Could somebody guide me on how to changed the PHP etc setting please.

 

Thanks

 

Hey PT5000, read the blog post in my signature with "php.ini" in it. It will give you more information to change it. Make sure to always back up and contact your hosting provider for any questions. Just for confirmation, what problem do you have exactly? What error message?

Link to comment
Share on other sites

Hey PT5000, read the blog post in my signature with "php.ini" in it. It will give you more information to change it. Make sure to always back up and contact your hosting provider for any questions. Just for confirmation, what problem do you have exactly? What error message?

 

Hi bud 

 

Thanks for the reply. All was fine until one morning, added a product fine when to add a product picture -- red box at the bottom saying undefined.

Link to comment
Share on other sites

[uPDATE]

 

Disabling Check the IP address on the cookie under Administration > Preferences did manage to solve the issue.

I assume that the extra bits added by Cloudflare in the cookie triggers that security setting.

Easy way would be to extend the class performing that security check by adding an array listing all of Cloudflare IPs.

Thank you. this  Disabling Check the IP address on the cookie under Administration > Preferences   did the trick for me, so I just disable it when adding new pictures and then enabling it again. Thanks again.

Link to comment
Share on other sites

  • 1 month later...

Hi,

If you want to avoid this error

you have to replace following files from prestashop 1.5.5

 

files are

 

/public_html/js/fileuploader.js

/public_html/admin0428/ajax-tab.php

 

please download the attached files and replace 

 

convert fileuploader.txt to fileuploader.js

 

and crear your cache

 

Best regards..!

Dileepa

ajax-tab.php

fileuploader.txt

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

  • 3 weeks later...

Hi,

If you want to avoid this error

you have to replace following files from prestashop 1.5.5

 

files are

 

/public_html/js/fileuploader.js

/public_html/admin0428/ajax-tab.php

 

please download the attached files and replace 

 

convert fileuploader.txt to fileuploader.js

 

and crear your cache

 

Best regards..!

Dileepa

thanks man, this tutorial is super.

I've used this to one of my shops.

 

I was looking for this issue from a week now.

In the beginning was ok.

Could be a problem with the url encoding of the image???

Can you explaine us the reason???

Thanks again.

You've saved me a lot of time and unsleeping nights.

Link to comment
Share on other sites

  • 1 month later...
  • 3 months later...

hi all,

 

i found something that worked.

 

"disable mod_security in preferences > SEO & URLS in the back office. 

 

The actual setting is "Disable Apache Mod Security" and you need to set it to "yes"

 

I also changed my image resolution. The file size was below 1mb but that wasn't the problem. My images were above 2000x3000 pixels so I changed the size to 900x1200 and that change coupled with the setting changed worked"

 

i got it from http://www.prestashop.com/forums/topic/294487-solution-for-error-undefined-when-uploading-product-images/

 

 

 

it only worked if i use 900x1200. now i do not know what size to use if i want to upload a landscape picture or my logo/banner ?

Thanks so much. This woks for my.

Link to comment
Share on other sites

  • 2 weeks later...

I am on PrestaShop version: 1.6.0.9 - Uploaded about 2 weeks ago to server space a Digital Ocean. A friend set up the OS and I think it's running nginx, php5, etc...  

I've built other sites, mostly with zen cart and liked the newer clean look of PrestaShop so I'm working on a PrestaShop site for a new client.

 

Spent the past 5+ hours researching why images stopped uploading. Only have about 10 images as I'm still formatting (working with default-bootstrap theme).

 

Tried some of the "tricks" in this thread but find some have already been included in this version. I know it's a bad idea but what worked was changing permissions on img and upload folders recursively.  By this time I was working in IE8 on my Windows 8 computer having gone from Chrome to Firefox to Safari then to IE. Just loaded Ubuntu onto an old laptop and was heading there next.

 

Decided to go back to recreate the issue.

In IE all images loaded and displayed fine after changing to 777.  Then I changed the imgs folder back to 775  hit refresh on my products page and lost the thumbnail images. Changed it back to 777 and they appeared again.

 

Went back to Chrome, changed permissions back to 775, and it's now working. Also changed this "Check the cookie's IP address" from Yes to No and Back to Yes again and it's allowing uploads.

 

I am not schooled or trained in coding but have been playing with it for many years. I am getting very frustrated by the errors when making backend changes. This needs to get fixed.

 

Although not the right thread for this - the other error I keep getting is this 

3 errors

  1. This link_rewrite field is required at least in English (English)
  2. Products must be in at least one category.
  3. This product must be in the default category.

I opened a product that is working to edit it. Made absolutely no changes and hit Save and get this error!!  I do absolutely nothing and hit Save again and I get "Successful update".  What is that all about??

 

Then there's the backend speed, or lack thereof!  

 

I will take these other issues to the appropriate thread but wanted to express my frustration with what I perceive as the bugs in this latest build.

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...

Just so you know how my hosting admin resolved this - this is what they had to do for me on the server:

 

"The site was triggering a chain of mod_security rules.  mod_security has now been completely deactivated for the subfolder in question."

 

The subfolder in question was the default prestashop admin folder - hope this helps someone else.

Link to comment
Share on other sites

  • 1 month later...

I have been working on this for the last 4 hours and this is what I found out.

 

Because I started to dig big whole before I checked the image i have lost 3.55hours. The only reason I had " Undefined " error is due to Image dimensions - Pixels. Changed it to 700x1000 and it all works fine now.

Link to comment
Share on other sites

  • 3 weeks later...

In my case the "undefined" error was related to Smush Optimize Image module and PS development mode being switched on. Apparently, the module (which automatically runs all uploaded images through Yahoo's SmushIt service) generated a few errors which were included in JSON response when development mode was enabled. This triggered the following error from fileuploader.js:

 

SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data

 

Disabling the development mode or/and the Smush Optimize Image module solved the problem.

 

Hope this helps.

Link to comment
Share on other sites

  • 4 months later...

On 1.5.4.1

 

Strange behavior and errors when uploading images with various browsers, definitely a pain though...

 

Chrome extension shows error TypeError: Cannot read property 'error' of null

http://www.myshop.com/js/fileuploader.js:366

 

Replaced fileuploader.js with original from same version, no luck. PHP limit is fine, "Smush It optimize" disabled and i am on Lighttpd server

 

Also, i cannot upload any .pdf file to product Attachments with error "invalid description". Maybe related, maybe not.

Link to comment
Share on other sites

  • 2 months later...

Hey there,

 

I'm glad I finally made to this 7th page! No single solution has helped so far... Frustrating. Prestashop oh prestashop.. Thanks for everyone's input so far though!

 

Allright, ce problem:

I'm using Prestashop 1.5.6.0 and get the undefined upload error since last 2 weeks. Also, I can't delete images since they simply change into a question mark..

 

The error:

SyntaxError: Unexpected token <
    at Object.parse (native)
    at XMLHttpRequest.xhr.onreadystatechange (http://www.gathershop.nl/js/fileuploader.js:1065:22)

 

I hope someone can help, much appreciated!!

 

Thanks,

 

 

Tim

Link to comment
Share on other sites

  • 2 months later...

I just migrate a 1.5.4.1 shop to a new server (we have migrated some prestashops from the same version to this server and theay all work just fine) , suddenly i cannot upload product images, it just shows an Undefined Error at the botom, and then when i refresh that product page in admin panel, shows me an image with the question mark.

 

Looking at the prestashop logs files it says this: 

 

2015/09/01 - 17:01:28: Duplicate entry '29575-1' for key 'PRIMARY'<br /><br /><pre>INSERT INTO `ps_image_lang` (`id_image`, `id_lang`) VALUES ('29575', '1')</pre> at line 607 in file classes/db/Db.php
*ERROR*
 
I went to that Db.php file and it is just the error returning function.
 
It is true that this id_image from ps_image_lang (29575) does exists, but where is the function that insert the record on that table??  i made a recursive search in the site files and i cant find anything, do someone has a clue of whats is going on with this?
 
Thank you in advance
Link to comment
Share on other sites

  • 1 year later...

Check Your apache error log.   I have problem with image upload and I had to change memory limit in php configuration to 256M.

 

Fri Oct 14 14:26:54.139784 2016] [fcgid:warn] mod_fcgid: stderr: PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to allocate 13392 bytes) in /xxxxx/public_html/classes/ImageManager.php on line 479, referer:

Link to comment
Share on other sites

  • 11 months later...

Hello !

I am still using 1.5.4.0 Version .

Today I get an Error.  "Undefined" while uploading product image .

I tried several solutions but nothing helped . :(

Finally I tried to

 

I disabled Apache Mod Security by checking "yes'' in back office - preferences - seo and urls -

 

And after that I can't access my website or back office at all .

I get white page

 

500 Internal Server Error .

 

Please help .

Maybe I can access some files trough cPanel and fix it back ?

 

website.  www.eksimanta.lv

 

Thanks .

Link to comment
Share on other sites

I have downloaded fresh .htaccess file and replaced my old one . And now website is up again . :)

 

But I still can't upload product photos . :(

 

Maybe I need to change memory limit from 128 to 256 ?

I can do it by my self or only my hosting company can do that ?

Link to comment
Share on other sites

×
×
  • Create New...