• knortonff

    (@knortonff)


    Hello,

    Having an issue uploading image files for our entries and I reviewed our php configs as well as the Plugin Settings and I am still getting the error. Below are the log files with annotations.
    We also tested uploading the file to the same location using a different file management plugin and it was successful.

    Thank You!

    [05/22/24 3:51pm UTC] record values in $_POST array

    \\ php.ini setting: upload_max_filesize = 3700M
    \\ Line 104: “if ( filesize( realpath( $field_file[ ‘tmp_name’ ][ $i ] ) ) > ini_get( ‘upload_max_filesize’ ) )” [05/22/24 3:51pm UTC] Undefined variable $field_file in C:\inetpub\wwwroot\wp-content\plugins\participants-database\classes\PDb_File_Uploads.php on line 104
    [05/22/24 3:51pm UTC] Trying to access array offset on null in C:\inetpub\wwwroot\wp-content\plugins\participants-database\classes\PDb_File_Uploads.php on line 104
    [05/22/24 3:51pm UTC] realpath(): Passing null to parameter #1 ($path) of type string is deprecated in C:\inetpub\wwwroot\wp-content\plugins\participants-database\classes\PDb_File_Uploads.php on line 104

    \\Error Message but file size is 124 KB
    [05/22/24 3:51pm UTC] File size exceeded php configuration limits: mccarthy.png Log file initiated at: May 22, 2024 3:51 pm UTC

    \\Screen Error Message is: The file you tried to upload is too large. The file must be smaller than 3700000K.
    [05/22/24 3:51pm UTC] strip_tags(): Passing null to parameter #1 ($string) of type string is deprecated in C:\inetpub\wwwroot\wp-admin\admin-header.php on line 36

    • This topic was modified 5 months ago by knortonff. Reason: Formatting
    • This topic was modified 5 months ago by knortonff.
Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author xnau webdesign

    (@xnau)

    With some server setups, the php configuration doesn’t propagate into the directory where the script is running. It could be because the php.ini file that you are editing isn’t in the right location. This may be something you need to ask your hosting provider about: how to make sure the php configuration values you are setting are active in the directories where WordPress is running.

    Thread Starter knortonff

    (@knortonff)

    I can tell the plug-in is getting the upload_max_filesize from PHP as I have edited it to see if the error message changed to match the changes I made the php.ini setting.

    Is it possible to hardcode the check value in the PDb_File_Uploads.php so it doesn’t reference the upload_max_filesize and just uses a hard coded value (which will be below upload_max_filesize) so it uploads the file correctly?

    Or am I barking up the wrong tree here and its not the upload_max_filesize value that is causing the error but something else? This is running on an IIS server I manage, so I have access to change anything needed to be changed.

    Thank You!

    Plugin Author xnau webdesign

    (@xnau)

    I don’t know if this will fix the issue for you, but I discovered an error in the PDb_File_Uploads.php script, on line 104, the variable name should be $file, not $field_file

    Plugin Author xnau webdesign

    (@xnau)

    Looking at the code, the error above is unlikely to fix the issue for you because when the is_uploaded_file() function is checked, it will return false if php didn’t sucessfully upload the file, so it seems likely it is a configuration issue.

    Changing how the script gets the upload size limit won’t fix this because this is not the reason it’s failing. I can’t actually tell you why its failing, php doesn’t provide that information. We’re just assuming its a file size issue because we’ve already checked other possibilities.

    It may be helpful to look at the system logs to see what happened with the upload.

    Thread Starter knortonff

    (@knortonff)

    OK, I corrected the $file variable name and did some more investigating and made sure fileinfo is enabled in php.ini and now I am getting a different error.

    Error on upload page: There is something wrong with the file you tried to upload. Try another.

    Log File Errors:
    [05/24/24 7:13pm UTC] Undefined variable $i in C:\inetpub\wwwroot\wp-content\plugins\participants-database\classes\PDb_File_Uploads.php on line 104
    [05/24/24 7:13pm UTC] String offset cast occurred in C:\inetpub\wwwroot\wp-content\plugins\participants-database\classes\PDb_File_Uploads.php on line 104

    This is how my Line 104 currently looks:
    if ( filesize( realpath( $file[ ‘tmp_name’ ][ $i ] ) ) > ini_get( ‘upload_max_filesize’ ) ) {

    Thank You,

    Plugin Author xnau webdesign

    (@xnau)

    This is expected because now that it isn’t erroneously saying the file is too large, we get the generic error message. This is because, as mentioned, we don’t know why the upload failed. This is something that is happening on the server level, so I suggest you check the server logs for anything that helps to explain what happened.

Viewing 6 replies - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.