Jump to content

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/301340-wont-show-failure-messages/
Share on other sites

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 by mac_gyver

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.

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.