Michal Gancarski Posted March 19, 2013 Share Posted March 19, 2013 Hi! I have finally managed to start my first project in ProcessWire. Loving the simplicity and flexibility but I have stumbled upon a problem with Image field. It just does not upload anything. What happens is: Upload progress bar is going up to 100%. Folders in assets/files are properly created, with permissions set to 777. Unfortunately, no image is being uploaded as there are no files in created folders. Nothing shows in Javascript console (Chrome and Firefox), so it is not a front-end problem. I have been searching for solution on this problem but what I have found was not helpful. I have safe_mode in PHP turned off. The issue persists for File fields as well. Thanks! Link to comment Share on other sites More sharing options...
adrian Posted March 19, 2013 Share Posted March 19, 2013 Do you have debug turned on in the config.php file? Also, add this to end of your body - at the end of your foot.inc file if that is how you have things set up: <?php if($config->debug && $this->user->isSuperuser()) include($config->paths->adminTemplates . "debug.inc"); ?> Let us know if those together produce any errors. Link to comment Share on other sites More sharing options...
Michal Gancarski Posted March 19, 2013 Author Share Posted March 19, 2013 Hi, Adrian! Thanks for your reply. I have turned debugging on and added the line to my templates. I am not sure which information would be useful but I have noticed that if debug is on, uploading stops at less than 100% (depending on the size of an image). I don't think it is about the allowed sizes for file uploads - uploading stops at what seems the last step in the process. Link to comment Share on other sites More sharing options...
Wanze Posted March 19, 2013 Share Posted March 19, 2013 This could be a server-side problem. Check the response of the ajax request sent. If you have enabled debug mode, maybe you can see the error that was throwed. Try with smaller files or increase the following php settings: post_max_size, upload_max_filesize, max_execution_time, max_input_time, memory_limit Link to comment Share on other sites More sharing options...
Mats Posted March 19, 2013 Share Posted March 19, 2013 My web host had a mod_security setting that caused the same problem. Link to comment Share on other sites More sharing options...
Michal Gancarski Posted March 19, 2013 Author Share Posted March 19, 2013 Hi, Mats!Can you tell me what the setting was? I can discuss it with my hosting provider. Thanks! Link to comment Share on other sites More sharing options...
Mats Posted March 19, 2013 Share Posted March 19, 2013 I've emailed the hosting provider about it. I'll get back as soon as i get a response from them. Link to comment Share on other sites More sharing options...
Mats Posted March 19, 2013 Share Posted March 19, 2013 They had overwritten the log file and couldn't specify the problem. Sorry. Link to comment Share on other sites More sharing options...
Mats Posted March 19, 2013 Share Posted March 19, 2013 Just realized you already checked the js console so this probably won't help you. Anyway it might help some one else with a similar problem. Here's a screen image of the problem i encountered and it gave the hoster a clue what caused the problem: https://docs.google.com/file/d/0B6dJoCa5mpgbNm94SnN6S1d3amc/edit?usp=sharing According to the hosting provider it was because of the mod_security setting but they couldn't be more specific than that. Hope you get it working. Link to comment Share on other sites More sharing options...
Michal Gancarski Posted March 19, 2013 Author Share Posted March 19, 2013 OK, I have talked with my hosting provider, they have also read this thread. We worked a bit to solve the issue and at the moment we come up with an error generated during upload, possibly at the very end of the process: PHP Warning: file_put_contents() [<a href='function.file-put-contents'>function.file-put-contents</a>]: Filename cannot be empty in /wire/core/Upload.php on line 128 I guess this is why progress bars stop just before the process finishes. I checked the line in Upload.php. I am unable to understand exactly what is what there but I am guessing this may be a problem with temporary folder. I have checked where the folder should be present (by printing $config->paths->tmp) and the path it showed me was /site/assets/tmp/. This folder did not exist. I have created it, switched permissions to 777 but it did not help. Link to comment Share on other sites More sharing options...
Michal Gancarski Posted March 20, 2013 Author Share Posted March 20, 2013 I have figured it out. Following the advice from here:http://processwire.com/talk/topic/1002-cant-upload-imagefiles-problem/ I have added uploadTmpDir which was apparently not set in /site/config.php. Now everything works.Taking advantage from this opportunity, I have a suggestion. Maybe ProcessWire should have this directory set by default? Is there any disadvantage to that? 1 Link to comment Share on other sites More sharing options...
ryan Posted March 20, 2013 Share Posted March 20, 2013 Glad you figured it out. We give first choice to $config->uploadTmpDir (if set), but prefer to use PHP's 'upload_tmp_dir' setting since this will presumably be somewhere outside the web accessible structure. It sounds like in your case, the server did not have PHP's 'upload_tmp_dir' setting defined. Now we could have uploadTmpDir set to something like /site/assets/uploads/ by default. But that's under the htdocs structure (though we do block it in htaccess) and I think it's a little more secure to have the server tell us where these files should go… at least as a default. Link to comment Share on other sites More sharing options...
Michal Gancarski Posted March 20, 2013 Author Share Posted March 20, 2013 Ah, I understand now. Thanks, Ryan, back to building! I think you have managed to create a CMS that is, contrary to Wordpress, Joomla or Drupal, fun to develop in. 1 Link to comment Share on other sites More sharing options...
buothz Posted April 30, 2016 Share Posted April 30, 2016 when I upload images on admin area bar remain to 100% error: on chrome console VM797:1 Uncaught SyntaxError: Unexpected token < in JSON at position 0parseJSON @ JqueryCore.js?v=162:16(anonymous function) @ InputfieldFile.js:171 With debug true: no errors on php I have not updated anything and even touched or database files, how can i resolve? Thanks Link to comment Share on other sites More sharing options...
adrian Posted May 1, 2016 Share Posted May 1, 2016 Try looking at the Network tab (make sure it is open before you upload the image). You should end up with a line that has an error - that will be the PHP error that will give you the info to figure out what is wrong. The error you are seeing in the console is a syntax error because the ajax call is returning the real error. My initial guess would be file/folder permissions, but if you let us know the error, we should be able to figure things out. 3 Link to comment Share on other sites More sharing options...
buothz Posted May 1, 2016 Share Posted May 1, 2016 Try looking at the Network tab (make sure it is open before you upload the image). You should end up with a line that has an error - that will be the PHP error that will give you the info to figure out what is wrong. The error you are seeing in the console is a syntax error because the ajax call is returning the real error. My initial guess would be file/folder permissions, but if you let us know the error, we should be able to figure things out. Hi, thank u for your help. I've opened Chrome Network tab, I don't see any PHP error (debug true) I see on network tab removeClass@JqueryCore.js?v=162:16removeClass@JqueryUI.js?v=180:587(anonymous function)@main.js?v=2:31handle@JqueryCore.js?v=162:17F@JqueryCore.js?v=162:17handle@JqueryCore.js?v=162:17k@JqueryCore.js?v=162:16 and Chrome console VM770:1 Uncaught SyntaxError: Unexpected token < in JSON at position 0parseJSON @ JqueryCore.js?v=162:16(anonymous function) @ InputfieldFile.js:171 JqueryCore.js?v=162:18 'webkitRequestAnimationFrame' is vendor-specific. Please use the standard 'requestAnimationFrame' instead. What can I do? And the right write permission on what folder? Thanks. Link to comment Share on other sites More sharing options...
horst Posted May 1, 2016 Share Posted May 1, 2016 do you see any notice / hint in the PW logs? site/assets/logs/errors.txt site/assets/logs/exceptions.txt site/assets/logs/warnings.txt 1 Link to comment Share on other sites More sharing options...
buothz Posted May 2, 2016 Share Posted May 2, 2016 do you see any notice / hint in the PW logs? site/assets/logs/errors.txt site/assets/logs/exceptions.txt site/assets/logs/warnings.txt errors.txt Error Exception: Method JqueryCore::addComponents does not exist or is not callable in this context (in /home/rvocsizt/public_html/wire/core/Wire.php line 232) #0 /home/rvocsizt/public_html/wire/modules/Jquery/JqueryCore/JqueryCore.module(39): Wire->__call('addComponents', Array) #1 /home/rvocsizt/public_html/wire/modules/Jquery/JqueryCore/JqueryCore.module(39): JqueryCore->addComponents(Array) #2 /home/rvocsizt/public_html/wire/core/Modules.php(327): JqueryCore->__construct() #3 /home/rvocsizt/public_html/wire/core/admin.php(15): Modules->get('JqueryCore') #4 /home/rvocsizt/public_html/site/templates-admin/controller.php(13): require('/home/rvocsizt/...') #5 /home/rvocsizt/public_html/site/templates/admin.php(13): require('/home/rvocsizt/...') #6 /home/rvocsizt/public_html/wire/core/TemplateFile.php(92): require('/home/rvocsizt/...') #7 [internal function]: TemplateFile->___render() #8 /home/rvocsizt/public_html/wire/core/Wire.php(271): call_user_func_array(Array, Array) #9 /home/rvocsizt/public_html/wire/core/Wi 2016-04-30 08:39:04 Error Exception: Method JqueryCore::addComponents does not exist or is not callable in this context (in /home/rvocsizt/public_html/wire/core/Wire.php line 232) #0 /home/rvocsizt/public_html/wire/modules/Jquery/JqueryCore/JqueryCore.module(39): Wire->__call('addComponents', Array) #1 /home/rvocsizt/public_html/wire/modules/Jquery/JqueryCore/JqueryCore.module(39): JqueryCore->addComponents(Array) #2 /home/rvocsizt/public_html/wire/core/Modules.php(327): JqueryCore->__construct() #3 /home/rvocsizt/public_html/wire/core/admin.php(15): Modules->get('JqueryCore') #4 /home/rvocsizt/public_html/site/templates-admin/controller.php(13): require('/home/rvocsizt/...') #5 /home/rvocsizt/public_html/site/templates/admin.php(13): require('/home/rvocsizt/...') #6 /home/rvocsizt/public_html/wire/core/TemplateFile.php(92): require('/home/rvocsizt/...') #7 [internal function]: TemplateFile->___render() #8 /home/rvocsizt/public_html/wire/core/Wire.php(271): call_user_func_array(Array, Array) #9 /home/rvocsizt/public_html/wire/core/Wi thanks Link to comment Share on other sites More sharing options...
Soma Posted May 2, 2016 Share Posted May 2, 2016 Nice error log with all the info's..m 1 Link to comment Share on other sites More sharing options...
buothz Posted May 2, 2016 Share Posted May 2, 2016 Nice error log with all the info's..m resolved Link to comment Share on other sites More sharing options...
gunter Posted May 11, 2016 Share Posted May 11, 2016 I have a image upload problem!The ajax gif is turning and not stopping...The image and the resized image appears in the assets/file/xxx folder... The image-sizer.txt log file says it has resized the image (I switched debug on) the ajax gif is still turning When I click save... the image isn´t added to the page...:-(It´s an fresh pw installation...And I tried it with several wamp servers (easynews, xampp) Link to comment Share on other sites More sharing options...
cstevensjr Posted May 11, 2016 Share Posted May 11, 2016 It´s an fresh pw installation... And I tried it with several wamp servers (easynews, xampp) Are you using ProcessWire 2.7.2, 2.7.3 or 3.0.17? PHP Version? List of any Third Party modules? Example of any custom code you are using? 1 Link to comment Share on other sites More sharing options...
adrian Posted May 11, 2016 Share Posted May 11, 2016 My first stop is always the Network tab of my dev console - there is probably an error from the ajax request that will appear there. 2 Link to comment Share on other sites More sharing options...
mauricius Posted May 14, 2016 Share Posted May 14, 2016 I have probably the same issue with an old PW 2.6 install on a shared hosting with PHP 5.5.32. The ajax upload completes with 100%, but I get Uncaught SyntaxError: Unexpected token < in the console. The problem is that the ajax request to admin/page/edit/?id=1067 ends with a 302 response code, therefore jQuery tries to parse the response of the root page, which obviously starts with <html>. I have the directive always_populate_raw_post_data set to Off, so I think that the problem is not related to https://github.com/ryancramerdesign/ProcessWire/issues/1174 and The directive upload_tmp_dir is set to /tmp/ with 755 permissions. No sign of errors in PW logs and messages. Anyone has clues? Link to comment Share on other sites More sharing options...
LostKobrakai Posted May 14, 2016 Share Posted May 14, 2016 ProcessWire does not return a response until the admin thumb is generated, therefore it could also be, that the image is successfully uploaded, but something prevented a successful addition to the page or the resizing. 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now