Error : "Invalid File" when delete image - Custom Field - User - Type : Image
Support › General › Error : "Invalid File" when delete image - Custom Field - User - Type : ImageResolved
- This topic has 12 replies, 3 voices, and was last updated 2 years, 9 months ago by
Long Nguyen.
-
AuthorPosts
-
August 29, 2021 at 7:09 PM #30478
justdoit123
ParticipantIn Custom Field for User - Type : Image.
I set limit 3 images and checked: Force deleteWhen i choose and upload an Image and Save, it show thumbnail, it worked.
but when i press X to delete that image.
it alert and not delete the image :: Error : Invalid File
Please see screenshot: https://vm.d.pr/wHQ8Jv
August 30, 2021 at 11:03 AM #30491Long Nguyen
ModeratorHi,
I do not experience that issue on my end. It is possible the image was deleted and was not removed in a short time and you click button X one more time. Please try to follow the Debugging Information step https://support.metabox.io/topic/how-to-create-a-new-topic/ and test this function again.
August 31, 2021 at 8:55 PM #30515justdoit123
Participanthi, i tried in many hosting to VPS.
Please login here and see:
https://metaboxtest.tastewp.com/wp-admin/profile.php
(removed)this is just a test site, please go to : wp-admin/profile.php
and scroll down to meta Image. Click x to delete an image and an alert will appear
August 31, 2021 at 9:01 PM #30516justdoit123
Participanti tested with admin role, editor, author role, same error, when i press X to delete that image.
it alert and not delete the image :: Error : Invalid File, cannot delete image after save.
August 31, 2021 at 10:23 PM #30518Long Nguyen
ModeratorHi,
Thank you for your feedback.
You can still delete the images but it shows the wrong message, screen record https://share.getcloudapp.com/eDuRRXeR
This issue might happen when the
image
field is a subfield inside a group. I will inform the development team to fix this in the next update.August 31, 2021 at 10:27 PM #30519justdoit123
ParticipantHi, it is only deleted in front, images are still there in Media : /wp-admin/upload.php
August 31, 2021 at 10:29 PM #30520justdoit123
Participantif i choose Image Advanced or Image upload, they will be deleted in Media too.
btw, can you add this feature to : Image Advanced or Image upload : real limit on choosing maximum images, i can still choose more than maximum and upload it to Media, Your limit only for frontend show up thumbnail.
September 1, 2021 at 10:51 AM #30529Long Nguyen
ModeratorHi,
Please use the field
image
orfile
as a top field, not a subfield to delete images/files when clicking "X" button. This issue will be fixed in the next update.Regarding the feature limit images on select, I will inform the development team to explore the possibility.
March 20, 2022 at 7:07 AM #34618sherwin_flight
ParticipantHi Long,
You previously mentioned "Please use the field image or file as a top field, not a subfield to delete images/files when clicking "X" button. This issue will be fixed in the next update."
Was this bug fixed?
March 21, 2022 at 12:17 PM #34695Long Nguyen
ModeratorHi Sherwin,
This issue has been fixed from version 5.4.7 of Meta Box. Can you please confirm it works?
March 23, 2022 at 3:48 AM #35221sherwin_flight
ParticipantOk, it seems I currently have version 5.4.0 installed.
I can probably get the newer version from my theme provider since I still have an active license with them and they may have already updated the theme.
If I want to update the bundled version of Metabox without updating the entire theme, can I just take the Metabox files from the updated version of the theme and just overwrite my current Metabox files with them?
The theme also came with some of the premium plugins bundled as well. Would those also need to be updated, or just Metabox Core?
Thanks for your help.
July 14, 2022 at 1:49 AM #36989sherwin_flight
ParticipantI have version 5.6.1 now, but I still seem to be having this problem.
I have a clone group set up, and there's an image file in it. I can clone the field and upload the images, that seems to all work as expected. But if I try to delete the files using the ajax delete option I can only delete one of the files. For the others I get the Invalid File! error.
The code that calls the error pop-up is:
if ( ( 'child' !== $type && ! in_array( $attachment, $field_value ) ) || ( 'child' === $type && ! in_array( $attachment, self::get_sub_values( $field_value, $request->filter_post( 'field_id' ) ) ) ) ) { wp_send_json_error( __( 'Error: Invalid file', 'meta-box' ) ); }
When I debug it a little it seems the array returned by the "self::get_sub_values" function returns a single entry, despite having added two clone groups with images. So I am able to delete the image that matches the one returned by this function, but for the others I get an error.
So the error is related to how the "self::get_sub_values" is building the array of values. it's not including all of my uploaded files.
July 18, 2022 at 9:08 PM #37062Long Nguyen
ModeratorPlease update the Meta Box plugin to the latest version 5.6.5 and re-check this issue. Let me know how it goes.
-
AuthorPosts
- You must be logged in to reply to this topic.