Uploaded files are not displayed
-
Thank you for your easy to use plugin.
I am trying to upload an audio file from a form to a custom field, but for some reason it is not working.
How can I solve this problem?
-
it is not working.
how do you know it is not working?
Your post title “Uploaded file not showing” suggest that you are trying to view the uploaded file in your backend. How?
- This reply was modified 2 years, 6 months ago by Aurovrata Venet.
Sorry for the lack of clarity.
We are performing the following steps
1. create a custom field that returns the URL of the uploaded file.
2. post my cf7 to send file to custom field
3. output the URL of the file to single.phpThere seems to be no problem with the form submission, but the file URL is not output to the site, and when I open the post edit screen, the custom field is empty.
There seems to be no problem with the form submission, but the file URL is not output to the site, and when I open the post edit screen, the custom field is empty.
thanks for the clarification. Let me check this on hmy server and get back to you
I checked and its working as expected on my server. Please verify,
1. you have no errors being reported on your server.
2. your submitted file is being uploaded to thewp-content/upload/<year>/<month>/
folder (there could be a write permission issue.)
3. that your file field is mapped properly.Thanks for the confirmation.
The file did not seem to be uploaded to
wp-content/upload/<year>/<month>/
.
Thumbnail images seem to upload fine, is it a permissions issue?If so, how can the permissions be changed?
if the thumbnail works but not the custom field, then its unlikely a file permission. More likely some other error.
Enable your WP_DEBUG mode with the following parameters in your
wp_config.php
,define('WP_GURUS_DEBUG', true); define('WP_DEBUG', true); if ( WP_DEBUG ) { define( 'WP_DEBUG_LOG', true ); define( 'WP_DEBUG_DISPLAY', false ); @ini_set( 'display_errors', 0 ); define('AUTOSAVE_INTERVAL', 600 ); //seconds }
the plugin will log (in the wp-content/debug.log file) the errors if any as to why the file is not being saved.
- This reply was modified 2 years, 6 months ago by Aurovrata Venet.
thanks.
I checked the debug log and found the following error
PHP Warning: call_user_func_array() expects parameter 1 to be a valid callback, no array or string given in wp-includes/class-wp-hook.php on line 303
I will look into it, but it doesn’t seem to have anything to do with the plugin.
Do you know what it is…?
it is the function used to call a function that is hooked by filter/action. This can be from your functions.php file or a plugin. Either way, the function is not being hooked properly.
I see, thanks.
I tried a few things and this error seemed to occur when loading the page.
However, it does not seem to occur when submitting a file through the form.
its actually a warning and not really an error, but could be pointing to something not working. Are you using hooks in your functions.php file?
another test you can run is to switch themes and see if it works with a default WP theme such as Twenty-nineteen
In function.php, we use several hooks.
another test you can run is to switch themes and see if it works with a default WP theme such as Twenty-nineteen
Will test this way once!
After some verification, the following results were obtained.
①. Form submission on current site with theme change: output failed.
②. Create a new site and submit a form with the default theme: output successful.
③. Form submission on site ② using the same theme as the site in question: output succeeds.
④. On the site in ③, add the same plugin as the site in question and submit the form: output successful
⑤. On the site in ①, stop all plug-ins and submit the form: output failedI checked the debug.log of ⑤ and found this error.
PHP Notice: Trying to get property 'user_nicename' of non-object in wp-includes/link-template.php on line 265
.
I went back through the logs and it looks like the error has occurred many times, but less than the number of times I have submitted the form.Is the custom field “user_nicname” being detected for some reason?
Is something in the existing configuration conflicting and causing the error…?Well done for the methodical testing ??
However, one thing you still need to rule out is the possibility that your initial setup (site #1) is corrupt at the WP core level. So I would suggest you re-isntall the core files (wp-admin/wp-include folders), just to make sure.
Thanks for the advice.
I re-installed wp-includes and it works fine!Now it is resolved, but I would like to report one other problem.
When I re-installed wp-includes and uploaded a media file, there was a problem with a 403 for the URL in question.
All files in the uploaded directory (May directory) were 403’d, and after checking permissions on directories, etc., everything looked fine.
I manually recreated the directory and it improved, and the directory automatically generated by wordpress (when uploaded from the admin page with the may directory deleted) was also fine.It is now resolved, but I wonder if this has something to do with the wp-includes change?
Thank you very much for your kind assistance in resolving the issue.
- The topic ‘Uploaded files are not displayed’ is closed to new replies.