Jump to content

(SOLVED) error 'undefined' uploading product image in version 1.5.6.1


Recommended Posts

Edit the js file "fileuploader.js" located in the "js" folder

( js/fileuploader.js )           

 

Then go to line 1075

 

Replace

xhr.setRequestHeader("Content-type","application/x-www-form-urlencoded");

 

with these two lines of code

 

xhr.setRequestHeader("Content-Type", "application/octet-stream");

xhr.setRequestHeader("processData", false);

  • Like 5
Link to comment
Share on other sites

  • 4 weeks later...

Didn't work in our PS 1.5.6.1. However, our hosting company is using cPanel 11 which has a "Web Application Firewall" that blocked image uploads (HTTP Error 406 was returned).

 

Solution: Open cPanel web-interface and go to the admin page of the Web Application Firewall. There you should see the log entry(ies) of the failed upload(s). On the right side click on "Details" and on the popup chose "deactivate rule". Now wait 1 - 5 minutes until this change take effect.

 

post-150787-0-77688900-1389625650_thumb.png

 

Hope it helps.

 

Link to comment
Share on other sites

  • 2 weeks later...

Edit the js file "fileuploader.js" located in the "js" folder

( js/fileuploader.js )           

 

Then go to line 1075

 

Replace

xhr.setRequestHeader("Content-type","application/x-www-form-urlencoded");

 

with these two lines of code

 

xhr.setRequestHeader("Content-Type", "application/octet-stream");

xhr.setRequestHeader("processData", false);

it's not works for me plz help

Link to comment
Share on other sites

  • 1 month later...

Didn't work in our PS 1.5.6.1. However, our hosting company is using cPanel 11 which has a "Web Application Firewall" that blocked image uploads (HTTP Error 406 was returned).

 

Solution: Open cPanel web-interface and go to the admin page of the Web Application Firewall. There you should see the log entry(ies) of the failed upload(s). On the right side click on "Details" and on the popup chose "deactivate rule". Now wait 1 - 5 minutes until this change take effect.

 

attachicon.gifcpanel.png

 

Hope it helps.

 

Hi,

 

I have Cpanel 11, but I don't see or find the web application firewall.

Link to comment
Share on other sites

  • 7 months later...

I am having the same problem. I uploaded my products using import wizard. A large number of products were uploaded with images but quite a few did not get their images. Since then whenever I try to manually upload an image I get this "undefined" error. On googling I found that some of the images that I intended to upload were too big in dimensions i.e. width x height. So I tried manually uploading smaller images but that still fails with undefined. I have also tried creating a new product and uploading an image and that does not work as well. The last thing I tried is to upload an image to a product which already has an image uploaded but unfortunately this also failed.

 

I am quite sure that this is not a permission issue. Firstly, the script managed to upload a number of images and failed for a few. Secondly, I have checked all the permissions and have now set them to 777 i.e. complete read write access to everyone (not recommended).

 

The only thing that I notice is in the Chrome console I get a 404 error.

POST http://mysite/admin/ajax-tab.php?id_product=7&id_category=0&token=bcda…%5D=Product+Name&legend%5B2%5D=Product+Name&qqfile=product.jpg 404 (Not Found) fileuploader.js:1078
qq.extend._upload fileuploader.js:1078
qq.UploadHandlerAbstract.upload fileuploader.js:767
qq.FileUploaderBasic._uploadFile fileuploader.js:401
qq.FileUploaderBasic._uploadFileList fileuploader.js:392
qq.FileUploaderBasic._onInputChange fileuploader.js:375
qq.UploadButton.onChange fileuploader.js:312
(anonymous function)

I don't see anything obvious in the cpanel that might not allow me to upload images and as earlier mentioned I have managed to upload a few already so I don't think that is not the case. I hope someone can help out.

Link to comment
Share on other sites

Edit the js file "fileuploader.js" located in the "js" folder

( js/fileuploader.js )           

 

Then go to line 1075

 

Replace

xhr.setRequestHeader("Content-type","application/x-www-form-urlencoded");

 

with these two lines of code

 

xhr.setRequestHeader("Content-Type", "application/octet-stream");

xhr.setRequestHeader("processData", false);

 

 

just tried this and it seems to be working. thanks

Link to comment
Share on other sites

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

Hi to fix the issue in prestashop 1.5.6.2

        xhr.setRequestHeader("Content-type","application/x-www-form-urlencoded"); //kraai Du Toit fixed  added this line 

       // xhr.setRequestHeader("Content-Type", "application/octet-stream");//kraai Du Toit remove this line 
Link to comment
Share on other sites

  • 6 months later...
  • 5 months later...
×
×
  • Create New...