Chrisj Posted June 13, 2016 Share Posted June 13, 2016 In the script I'm using, I moved 'upload_avatar.php' and 'inner_upload_avatar.htm' from a Folder into the public_html and public_html/templates folder respectively. They work successfully there. The only thing I changed on 'upload_avatar.php' was this: include_once ('..classes/config.php'); include_once ('..classes/sessions.php'); to this: include_once ('classes/config.php'); include_once ('classes/sessions.php'); But, the only thing that doesn't work is the unsuccessful messages. When an image uploads successfully "Request has been completed" appears. But when I upload a non-image file type, or file too large, I see nothing. The script before I moved it shows" File dimensions error", or "File type not allowed". I'm stumped as to why those messages don't appear. I've attached upload_avatar.php. If you could help me figure out why this is the case, or suggest a simple work around, I'd greatly appreciate it. (Also, I know this code is old). Thanks. upload_avatar.php Quote Link to comment https://forums.phpfreaks.com/topic/301340-wont-show-failure-messages/ Share on other sites More sharing options...
QuickOldCar Posted June 13, 2016 Share Posted June 13, 2016 Is your log file being written to? This is location you have, is it still that location? $log_file = '../logs/avatar_log.txt'; Quote Link to comment https://forums.phpfreaks.com/topic/301340-wont-show-failure-messages/#findComment-1533630 Share on other sites More sharing options...
Chrisj Posted June 13, 2016 Author Share Posted June 13, 2016 Thanks for your reply. My answer is I don't know Can you help me determine that? Quote Link to comment https://forums.phpfreaks.com/topic/301340-wont-show-failure-messages/#findComment-1533631 Share on other sites More sharing options...
Chrisj Posted June 13, 2016 Author Share Posted June 13, 2016 Sorry about my unintelligent reply. The failure is not showing in the log file, but I am getting admin notices by email of the failure Quote Link to comment https://forums.phpfreaks.com/topic/301340-wont-show-failure-messages/#findComment-1533632 Share on other sites More sharing options...
mac_gyver Posted June 13, 2016 Share Posted June 13, 2016 (edited) what do you get in your browser for the cases where it doesn't work? and if you get a blank page, what does the 'view source' of the blank page show? what folder(s) exactly did these two files start in? the .php code is looking in a relative folder path - "themes/$user_theme/templates/"; to find the template file. unless you moved (or did you copy it, leaving the original where it was) the template to a new location that has that exact same relative path structure, this shouldn't be able to even display the form. edit: the reason you are not getting anything in the application's log file is because it uses a relative path in the code and when you moved the .php file, it broke the path. there would be php errors about this if php's error reporting was turned full on. Edited June 13, 2016 by mac_gyver Quote Link to comment https://forums.phpfreaks.com/topic/301340-wont-show-failure-messages/#findComment-1533633 Share on other sites More sharing options...
Chrisj Posted June 13, 2016 Author Share Posted June 13, 2016 Thanks for your reply. In the browser, it stays the same ../upload_avatar.php When I right-click the blank page to 'view source' I see this: "Confirm Form Resubmission This webpage requires data that you entered earlier in order to be properly displayed. You can send this data again, but by doing so you will repeat any action this page previously performed. Press the reload button to resubmit the data needed to load the page. ERR_CACHE_MIS" Yes, I copied the template and .php file. I know have two places in the script with this Form. The original shows the errors properly, and the new Form only shows "Request has been completed", but a blank page for wrong file size or wrong file type. So, I'm not clear on what to do next, regarding the missing relative path, or a work around. Any additional help will be appreciated. Quote Link to comment https://forums.phpfreaks.com/topic/301340-wont-show-failure-messages/#findComment-1533635 Share on other sites More sharing options...
mac_gyver Posted June 13, 2016 Share Posted June 13, 2016 i was going through this terrible brute-force-built phpmotion code, trying to figure out what it thinks it is trying to do (i do know what it is trying to do, the Author wasn't so clear on this), and i found why it doesn't work for the validation errors. sorry for the commentary, but this code is so bad and repetitive, i got dizzy looking at it. there's 370 lines of bad code that it would take about 150 lines of good code to accomplish the same thing. the die_with_msg() function is trying to load the template file, but it is referencing the $user_theme variable to form the path. that variable doesn't exist inside the die_with_message() function. there would be a php error about the undefined variable, if php's error reporting was turned fully on and if you turned on the template error setting, you would get an error about not being able to load the template. these same messages either don't work at all for both the original location of the files and the copied location of the files OR you have some sort of symbolic path setup or you have previously duplicated some of the template files, so that the path produced by the missing $user_theme variable matches an actual path for the original location of the files, but not the copied location of the files. so, why are you actually moving these files? if you want to change/test the functionality of the form processing code, you would make a copy of the .php file, in a different location, but use the same template in it's original location. you could actually just make a copy of the .php file in the same location with the original file, but with a different name, but you would need to remove the action='upload_avatar.php' attribute. no action attribute or an empty value submits to the same url that the form is at. Quote Link to comment https://forums.phpfreaks.com/topic/301340-wont-show-failure-messages/#findComment-1533636 Share on other sites More sharing options...
Chrisj Posted June 14, 2016 Author Share Posted June 14, 2016 Thanks for your help. Much apppreciated Quote Link to comment https://forums.phpfreaks.com/topic/301340-wont-show-failure-messages/#findComment-1533637 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.