Kami Solutions Posted November 20, 2013 Share Posted November 20, 2013 (edited) Hi everybody, I'm having issues uploading product images, for example when I try to upload an image and then click on upload button, it does nothing. When I try to exit from the tab, it says that i have services running, and all changes could not be saved. When I exit it shows on the footer an error "undefined". I think it's a database problem or code problem, because when I try to export the csv file in the image column links the image to "http://www.myweb.com/img/p/0.jpg". And if I try to import the csv that i have just exported, it makes no changes. Please, help me, i'm desesperated, i have products and I don't know how to save all the work and fix this problem. Best regards, centrobolsos EDIT: I FIXED THE PROBLEM! There was an issue with FileUploader.php, in line 166 $temp = tmpfile(); missing. Edited November 20, 2013 by centrobolsos (see edit history) 1 Link to comment Share on other sites More sharing options...
vekia Posted November 20, 2013 Share Posted November 20, 2013 thank you so much for solution, im going to mark this topic as [solved] i bookmarked this thread, because issue you had sometimes appears for other merchants here wtih regards, Milos 1 Link to comment Share on other sites More sharing options...
maxime bouillard Posted November 20, 2013 Share Posted November 20, 2013 Hello, I'm having the same problem, line 166 is that one right? $image = new Image(); $image->id_product = (int)($product->id); $image->position = Image::getHighestPosition($product->id) + 1; <<<<<< $legends = Tools::getValue('legend'); if (is_array($legends)) can you copy line 160 to 166 so i can check if mine is the same? Thanks =) Link to comment Share on other sites More sharing options...
Kami Solutions Posted November 21, 2013 Author Share Posted November 21, 2013 Hello, I'm having the same problem, line 166 is that one right? $image = new Image(); $image->id_product = (int)($product->id); $image->position = Image::getHighestPosition($product->id) + 1; <<<<<< $legends = Tools::getValue('legend'); if (is_array($legends)) can you copy line 160 to 166 so i can check if mine is the same? Thanks =) Hello, i'll copy and paste the entire function (working): public function upload($path) { $target = fopen($path, 'w'); $temp = tmpfile(); /* <-- The missing line that makes the error (my case) */ $realSize = stream_copy_to_stream($input, $target); if ($realSize != $this->getSize()) return false; fclose($input); fclose($target); return true; } Best regards, Centrobolsos 1 Link to comment Share on other sites More sharing options...
theseedguy Posted November 23, 2013 Share Posted November 23, 2013 I'm have the exact same problem, however, I'm no programmer - and your posts are way out of my league. However, I'd still appreciate a simple, step by step procedure on how to fix this error. When I press the "upload an image" button to add a picture for my product...it does nothing. Completely nothing. I've added products for months - never a problem until now. I would so appreciate some assistance...as this is costing our company money. Thanks so much!! Link to comment Share on other sites More sharing options...
BrunoSantos Posted November 24, 2013 Share Posted November 24, 2013 Hello, Same issue here after the 1.5.6.1 upgrade. I executed this solution and cleared cache but the problem keeps. Any other option? Thank you Link to comment Share on other sites More sharing options...
imugur Posted November 24, 2013 Share Posted November 24, 2013 There was an issue with FileUploader.php, in line 166 $temp = tmpfile(); missing. in what folder this file is located? I searched but apparently is missing. I just upgraded to 1.5.6.1 but it worked for some time after the upgrade before stopping... Link to comment Share on other sites More sharing options...
BrunoSantos Posted November 24, 2013 Share Posted November 24, 2013 www\classes Link to comment Share on other sites More sharing options...
fiddler1 Posted November 24, 2013 Share Posted November 24, 2013 (edited) Hi, everyone. I'm having a similar problem with my Prestashop store after updating to 1.5.6.1. When I try to upload a product image from inside the Images tab under Catalog - Products, the "Undefined" error bar appears. The console shows my webserver is returning the 403 Forbidden error. So this looks like a problem with permissions. I've tried the fix to FileUploader.php given above, and have tried disabling the Apache mod_security either by changes to .htaccess and/or turning off the switch in Prestashop back office. None of these cured the problem. I had no trouble until after the update. According to my console, Prestashop is attempting to upload the picture by posting to ajax-tab.php in the admin folder. Interestingly, I am able to copy the post URL, including my latest security token into the Firefox / Chrome add-on "Poster", and manually post the file, it works! Using Post, the image is processed and saved by Prestashop and shows up in all the right places. But posting it using the Prestashop GUI will not work at all - always the undefined error resulting from the "Forbidden" 403. Posting category pictures works fine, which apparently posts with a completely different method. Note that the manual posting method using Chrome Post works even with mod_security fully enabled. Any thoughts? Thanks for any suggestions. I've read older related posts and bug reports about this issue already. Thanks!! My configuration info is below in case it's useful. I know my browser is ancient; I had the same trouble with IE under Windows 7. Server information Server information: Linux #1 SMP Wed Apr 3 12:05:42 EEST 2013 x86_64 Server software version: Apache PHP version: 5.3.26 Memory limit: 128M Max execution time: 30 Database information MySQL version: 5.1.70-cll MySQL engine: InnoDB Tables prefix: ps_ Store information PrestaShop version: 1.5.6.1 Shop URL: https://www.donleyviolins.net/shopping/ Current theme in use: theme1 Mail configuration Mail method: You are using the PHP mail function. Your information Your web browser: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:11.0) Gecko/20100101 Firefox/11.0 Edited November 25, 2013 by fiddler1 (see edit history) Link to comment Share on other sites More sharing options...
Brighteyes Posted November 25, 2013 Share Posted November 25, 2013 "Undefined Error" for me too. All works fine with the same server using 1.5.6 But with 1.5.6.1 I can't upload any product images. New I shouldn't have installed the latest version! Link to comment Share on other sites More sharing options...
Kami Solutions Posted November 25, 2013 Author Share Posted November 25, 2013 For all you guys have upgraded to 1.5.6.1, have you tried to download the main source from prestashop and then copy and paste the FileUpload.php? Link to comment Share on other sites More sharing options...
Kami Solutions Posted November 25, 2013 Author Share Posted November 25, 2013 I'm have the exact same problem, however, I'm no programmer - and your posts are way out of my league. However, I'd still appreciate a simple, step by step procedure on how to fix this error. When I press the "upload an image" button to add a picture for my product...it does nothing. Completely nothing. I've added products for months - never a problem until now. I would so appreciate some assistance...as this is costing our company money. Thanks so much!! Have you got acess to the ftp? In that case you have to find the FileUpload.php and then double click it and open with any text editor. Link to comment Share on other sites More sharing options...
Brighteyes Posted November 25, 2013 Share Posted November 25, 2013 Trying that now..... Link to comment Share on other sites More sharing options...
Brighteyes Posted November 25, 2013 Share Posted November 25, 2013 Can't even download Prestashop. it seems to freeze right at the end. Tried using various browsers. Link to comment Share on other sites More sharing options...
fiddler1 Posted November 25, 2013 Share Posted November 25, 2013 Thanks for the suggestion, Centrobolsos regarding uploading FileManager.php from the Prestashop source code. I tried that but it did not help. I don't see any difference between the FileManager.php I downloaded from Prestashop, and the same file I used in the Softaculous package to update my installation. Of course there should not be any difference, but it was worth a try. The new FileManager.php does not include the edit discussed earlier in this thread, and this edit made no difference on my system. Uploading images through the Prestashop GUI returns "undefined" based on a 403-Forbidden error, but manually uploading the images using Poster works fine, regardless of the Line 166 edit on FileManager.php. I wonder if Brighteyes was having trouble with the internet connection during download. I have also noticed that a loss of internet service during image upload will cause Prestashop to throw the "undefined" error, so it's important to look at the webconsole to see what error is being returned by the server. So if anyone wants to guess what's going on here, we're still open for your ideas! Thanks!! Link to comment Share on other sites More sharing options...
Brighteyes Posted November 25, 2013 Share Posted November 25, 2013 Thanks for the suggestions... I have spent all day on this, it's nothing to do with internet connection. The web console throws a 406 error (see attachment). This happens in all browsers both Mac & PC. I've turned off mod security i Prestsahop and nothing. It's not server based because my other 4 shops using 1.5.6 work fine all on the same server. This (for me) is unique to 1.5.6.1 and is specifically affecting product image uploads. I can't wait for Prestashop as this is holding up my project. I need to re create this site from scratch using 1.5.6 and just avoid upgrading. Link to comment Share on other sites More sharing options...
zainoz.zaini Posted November 26, 2013 Share Posted November 26, 2013 (edited) Try change js/fileuploader.js line 1075 to xhr.setRequestHeader("Content-Type", "application/octet-stream"); xhr.setRequestHeader("processData", false); its work for me. ref: https://github.com/PrestaShop/PrestaShop/commit/2a1c991612c7b7d48f819b55f31218c93c5509fd#diff-082532a88d14c81e16f249821c766c59L1078 Edited November 26, 2013 by zainoz.zaini (see edit history) 4 Link to comment Share on other sites More sharing options...
imugur Posted November 26, 2013 Share Posted November 26, 2013 Try change js/fileuploader.js line 1075 to xhr.setRequestHeader("Content-Type", "application/octet-stream"); xhr.setRequestHeader("processData", false); its work for me. ref: https://github.com/PrestaShop/PrestaShop/commit/2a1c991612c7b7d48f819b55f31218c93c5509fd#diff-082532a88d14c81e16f249821c766c59L1078 Works for me also!!! Thanks Link to comment Share on other sites More sharing options...
fiddler1 Posted November 26, 2013 Share Posted November 26, 2013 Thanks, zainoz.zaini! That fix to fileuploader.js worked for me also! I had not seen Roussac's post on GitHub documenting the change. That was definitely the problem for me, and now it's fixed. And I have mod_security fully enabled. So if this works for Brighteyes also, we can mark this one as "Solved" thanks to Roussac and zainoz.zaini! It's so nice to see the little green bar that tells you the image upload was a success! Link to comment Share on other sites More sharing options...
karikolraj Posted November 27, 2013 Share Posted November 27, 2013 I tried the above methods, still no luck ( still not able to upload any product images 1 Link to comment Share on other sites More sharing options...
karikolraj Posted November 27, 2013 Share Posted November 27, 2013 Works for me also!!! Thanks I tried exactly as mentioned in the link, bust still getting the same undefined error. What could be the problem. I am using Prestashop 1.5.6.1 in my site www.cloble.com Can anyone suggest any solution for me ??? Link to comment Share on other sites More sharing options...
fiddler1 Posted November 27, 2013 Share Posted November 27, 2013 Karikolraj, if you can monitor with a web console while you try to upload the image and post the error returned by the server, it will help us help you. Prestashop can throw the "undefined" error for many reasons. Can you upload category images with no problem? Link to comment Share on other sites More sharing options...
mytoshi Posted November 27, 2013 Share Posted November 27, 2013 (edited) I'm using 1.5.6.0 and used Autoupdate, now I can upload image for categories but for products I got same error "undefined" below is the error I received in browser consol: [01:23:07.868] POST http://xxxx.com/admin123/ajax-tab.php?id_product=1&id_category=0&token=16e2bbac185d40c092d96971f299e597&tab=AdminProducts&action=addImage&ajax=1&legend%5B1%5D=iPod+Nano&legend%5B2%5D=iPod+Nano&qqfile=micoucs.jpg [HTTP/1.1 404 Not Found 5200ms] pls help my problem also solved with cleaning the cache Edited November 27, 2013 by mytoshi (see edit history) Link to comment Share on other sites More sharing options...
karikolraj Posted November 27, 2013 Share Posted November 27, 2013 Karikolraj, if you can monitor with a web console while you try to upload the image and post the error returned by the server, it will help us help you. Prestashop can throw the "undefined" error for many reasons. Can you upload category images with no problem? Some how it worked now. I cleared my browser cache and tried with the changes given, it worked. Thanks Link to comment Share on other sites More sharing options...
Koyot Posted November 27, 2013 Share Posted November 27, 2013 Try change js/fileuploader.js line 1075 to xhr.setRequestHeader("Content-Type", "application/octet-stream"); xhr.setRequestHeader("processData", false); its work for me. ref: https://github.com/PrestaShop/PrestaShop/commit/2a1c991612c7b7d48f819b55f31218c93c5509fd#diff-082532a88d14c81e16f249821c766c59L1078 Works for me (1.5.6.1)! Thanks! Link to comment Share on other sites More sharing options...
noclue Posted November 29, 2013 Share Posted November 29, 2013 worked for me too Thanks for the fix! Link to comment Share on other sites More sharing options...
krajniak Posted December 3, 2013 Share Posted December 3, 2013 (edited) Same problem for me! Is anybody working on this topic? Is there any way to upload in some other (for example "manual") way? (PS. Clearing cache and adding presented lines did not work for me) EDIT: Ok, it works after deleting cache but not under Opera browser Edited December 3, 2013 by krajniak (see edit history) Link to comment Share on other sites More sharing options...
Kami Solutions Posted December 3, 2013 Author Share Posted December 3, 2013 Same problem for me! Is anybody working on this topic? Is there any way to upload in some other (for example "manual") way? (PS. Clearing cache and adding presented lines did not work for me) EDIT: Ok, it works after deleting cache but not under Opera browser Hi, yes you can upload images manually by .xls You have to upload the images in folders by FTP and then type the URL in the .xls document and import it Link to comment Share on other sites More sharing options...
dtanon Posted December 4, 2013 Share Posted December 4, 2013 Try change js/fileuploader.js line 1075 to xhr.setRequestHeader("Content-Type", "application/octet-stream"); xhr.setRequestHeader("processData", false); its work for me. ref: https://github.com/PrestaShop/PrestaShop/commit/2a1c991612c7b7d48f819b55f31218c93c5509fd#diff-082532a88d14c81e16f249821c766c59L1078 This work for me (presta 1.5.6.1) 1 Link to comment Share on other sites More sharing options...
florianj Posted December 5, 2013 Share Posted December 5, 2013 to change fileuploader.js line 1075 worked for me too... just to understand: what does the change mean for non-professionals? Link to comment Share on other sites More sharing options...
zainoz.zaini Posted December 6, 2013 Share Posted December 6, 2013 (edited) to change fileuploader.js line 1075 worked for me too... just to understand: what does the change mean for non-professionals? When data that has been entered into HTML forms is submitted, the form field names and values are encoded and sent to the server in an HTTP request message using method GET or POST. The header declared as application/x-www-form-urlencoded - is used to encode percent-encoding rules, with a number of modifications such as newline normalization and replacing spaces with "+" instead of "%20". Since we want to send picture (encoded as base64 that represent binary data) then it embedded into the header, so the request will not acceptable because response entities which have content characteristics not acceptable according to the accept headers sent in the request (error 406). Thus, the content type has to be specified. The application/octet-stream in the header declares is an arbitrary binary data is contained from the request. Edited December 6, 2013 by zainoz.zaini (see edit history) Link to comment Share on other sites More sharing options...
alekzz Posted December 6, 2013 Share Posted December 6, 2013 Works for me (1.5.6.1)! Thanks! same here ! (1.5.6.1) ! Clear the cache. Thanks a lot. Link to comment Share on other sites More sharing options...
afiqtech Posted December 9, 2013 Share Posted December 9, 2013 (edited) I tried the above methods, still no luck ( still not able to upload any product images what i did is, highlight the 1075 code in js/fileuploader. just highlight the code, and replace with xhr.setRequestHeader("Content-Type", "application/octet-stream"); xhr.setRequestHeader("processData", false);and save it, with doing nothing else. hope this will help you. make exactly like this from line 1074 until 1079 1074 xhr.open("POST", queryString, true); 1075 xhr.setRequestHeader("Content-Type", "application/octet-stream"); 1076 xhr.setRequestHeader("processData", false); 1077 xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest"); 1078 xhr.setRequestHeader("X-File-Name", encodeURIComponent(name)); 1079 xhr.send(file); Edited December 9, 2013 by afiqtech (see edit history) Link to comment Share on other sites More sharing options...
afiqtech Posted December 9, 2013 Share Posted December 9, 2013 (edited) I tried the above methods, still no luck ( still not able to upload any product images change the code found in directory js/fileuploader.js from line 1074 until 1079. make it exactly like this 1074 xhr.open("POST", queryString, true); 1075 xhr.setRequestHeader("Content-Type", "application/octet-stream"); 1076 xhr.setRequestHeader("processData", false); 1077 xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest"); 1078 xhr.setRequestHeader("X-File-Name", encodeURIComponent(name)); 1079 xhr.send(file); get the attachment below, hope get it clearly for you. Edited December 9, 2013 by afiqtech (see edit history) Link to comment Share on other sites More sharing options...
simply5 Posted December 11, 2013 Share Posted December 11, 2013 Hey zainoz.zaini,It work for me also. you save my day. million thks. :) Link to comment Share on other sites More sharing options...
vahidafshari Posted December 11, 2013 Share Posted December 11, 2013 It doesn't work for me not missing line 166 in classes/fileuploader.php AND not changging line 1074 to 1079 in js Link to comment Share on other sites More sharing options...
amanullah.en Posted December 12, 2013 Share Posted December 12, 2013 (edited) I have got an another solution.... I tried every method discussed here but i failed to recover my problem..... By 2 days efort finally I got another solution which disscussed below.... My domain is a subdomain like "shop.mydomain.com" and my prestashop software was installed in this domain folder "shop". I explore that when I use my url like "shop.mydomain.com/admin" (default) it did not work but when I use my url like "mydomain.com/shop/adminfolder" then it work without any change of the software/program. If you are using a subdomain, I suggest you to use the url like "yourdomain.com/subdomain-name/adminfolder" only for uploading the product image. Otherwise use default url. Now I am using the version 1.5.6.1 by tihs method without any "undefined" error... NB: After your login the software will show you a warning message to change your domain. Please don't any response of this warning message. Edited December 12, 2013 by amanullah.en (see edit history) Link to comment Share on other sites More sharing options...
d22009 Posted December 24, 2013 Share Posted December 24, 2013 Works for me also!!! Thanks worked for me thank you been bugging me for weeks Link to comment Share on other sites More sharing options...
puffdade Posted December 24, 2013 Share Posted December 24, 2013 I followed all of the above to the letter and it will not work for me any more clues ? Link to comment Share on other sites More sharing options...
trandinhhong Posted January 8, 2014 Share Posted January 8, 2014 (edited) i have sampe problem in version 1.5.6.1. and in hostting. i can not upload image product . , no problem if i'm using localhost. Uploaded with ImageShack.us thank very much (sorry ,i'm using english language very bad ). Edited January 8, 2014 by trandinhhong (see edit history) Link to comment Share on other sites More sharing options...
zizebra Posted January 9, 2014 Share Posted January 9, 2014 After trying all the things mentioned in this thread Prestashop Newbies solution worked for me. Images can only be uploaded by using yourdomain.com/subdomain-name/adminfolder" 1 Link to comment Share on other sites More sharing options...
simply5 Posted January 10, 2014 Share Posted January 10, 2014 Try change js/fileuploader.js line 1075 to xhr.setRequestHeader("Content-Type", "application/octet-stream"); xhr.setRequestHeader("processData", false); its work for me. ref: https://github.com/PrestaShop/PrestaShop/commit/2a1c991612c7b7d48f819b55f31218c93c5509fd#diff-082532a88d14c81e16f249821c766c59L1078 thks alot, it work for me. Link to comment Share on other sites More sharing options...
krabi Posted January 18, 2014 Share Posted January 18, 2014 I have got an another solution.... I tried every method discussed here but i failed to recover my problem..... By 2 days efort finally I got another solution which disscussed below.... My domain is a subdomain like "shop.mydomain.com" and my prestashop software was installed in this domain folder "shop". I explore that when I use my url like "shop.mydomain.com/admin" (default) it did not work but when I use my url like "mydomain.com/shop/adminfolder" then it work without any change of the software/program. If you are using a subdomain, I suggest you to use the url like "yourdomain.com/subdomain-name/adminfolder" only for uploading the product image. Otherwise use default url. Now I am using the version 1.5.6.1 by tihs method without any "undefined" error... NB: After your login the software will show you a warning message to change your domain. Please don't any response of this warning message. I tried all above this post and it didn't work, but this was the problem, now is ok... Thank you amanullah.en !! Link to comment Share on other sites More sharing options...
bubbashatz Posted January 19, 2014 Share Posted January 19, 2014 I tried the above methods too, and still no luck still not able to upload any product images Link to comment Share on other sites More sharing options...
trandinhhong Posted January 19, 2014 Share Posted January 19, 2014 I tried the above methods too, and still no luck still not able to upload any product images u can tried my way. http://www.prestashop.com/forums/topic/283596-error-on-image-uploading/page-2?do=findComment&comment=1530805 Link to comment Share on other sites More sharing options...
berticro Posted January 24, 2014 Share Posted January 24, 2014 change the code found in directory js/fileuploader.js from line 1074 until 1079. make it exactly like this 1074 xhr.open("POST", queryString, true); 1075 xhr.setRequestHeader("Content-Type", "application/octet-stream"); 1076 xhr.setRequestHeader("processData", false); 1077 xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest"); 1078 xhr.setRequestHeader("X-File-Name", encodeURIComponent(name)); 1079 xhr.send(file); get the attachment below, hope get it clearly for you. Fresh install of 1.5.6.2 today (24.01.2014) my fileuploader.js: 1074 xhr.open("POST", queryString, true); 1075 xhr.setRequestHeader("Content-Type", "application/octet-stream"); 1076 xhr.setRequestHeader("processData", false); 1077 xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest"); 1078 xhr.setRequestHeader("X-File-Name", encodeURIComponent(name)); 1079 xhr.send(file); DOESNT WORK !!! Same issue on two 1.5.5.0 shops on two different servers I manage those shops with eMagic Manager for PrestaShop, but i think Presta Team will have to solve this problem Link to comment Share on other sites More sharing options...
photocreative Posted January 25, 2014 Share Posted January 25, 2014 brilliantthanksI had gone mad talking to managers and mod security rules ..Thanks again Link to comment Share on other sites More sharing options...
wakeforce139 Posted January 25, 2014 Share Posted January 25, 2014 The solution that worked for me was changing the .htaccess file in domain/js folder to an older version. I feel confident this will solve the majority of users' problem. Link to comment Share on other sites More sharing options...
PeteZ Posted February 4, 2014 Share Posted February 4, 2014 deleted the htaccess file in js folder. all working as it should now Link to comment Share on other sites More sharing options...
mehdi09 Posted March 5, 2014 Share Posted March 5, 2014 Hello, I have an 1.5.6.2 PrestaShop fresh install. I tried all methods mentionned above: /classes/FileUploader.php (I don't have the same as you mentionned on line 166) I modified nothing. /js/fileuploader.js (I changed the line 1075 as mentionned) delete the .htaccess file in /js folder (still same) You can see my PHP info here: http://www.louerbateaumarseille.com/phpinfo.php Do I need to create a new topic ? Thanks a lot for your help Link to comment Share on other sites More sharing options...
captainschoice Posted April 15, 2014 Share Posted April 15, 2014 I have the same issue with Prestashop 1.5.6.1 and getting the "Undefined" error when I try to upload. I have tried everything suggested here and nothing seems to work. I tried using Chrome, Firefox and even IE. In IE I got the following error info: Webpage error details User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E) Timestamp: Tue, 15 Apr 2014 01:24:59 UTC Message: Permission denied Line: 914 Char: 13 Code: 0 That particular line seems to be related to a fix for Opera This is very frustrating. Link to comment Share on other sites More sharing options...
KATPAT34 Posted April 15, 2014 Share Posted April 15, 2014 I'm have the exact same problem, however, I'm no programmer - and your posts are way out of my league. However, I'd still appreciate a simple, step by step procedure on how to fix this error. When I press the "upload an image" button to add a picture for my product...it does nothing. Completely nothing. I've added products for months - never a problem until now. I would so appreciate some assistance...as this is costing our company money. Also, is there a trick to being able to see the posts made by others on here? I can only see replies but cant see the solutions people posted and can find anywhere to click on the i.e "4 Posts" button etc under each persons comments.... Not normally a nufty with computers but cant fiure this one out either Link to comment Share on other sites More sharing options...
Recommended Posts