Support Forum
Support › General › Error : "Invalid File" when delete image - Custom Field - User - Type : ImageResolved
In Custom Field for User - Type : Image.
I set limit 3 images and checked: Force delete
When 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
Hi,
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.
hi, 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
i 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.
Hi,
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.
Hi, it is only deleted in front, images are still there in Media : /wp-admin/upload.php
if 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.
Hi,
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.
Regarding the feature limit images on select, I will inform the development team to explore the possibility.
Hi 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?
Hi Sherwin,
This issue has been fixed from version 5.4.7 of Meta Box. Can you please confirm it works?
Ok, 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.
I 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.
Please update the Meta Box plugin to the latest version 5.6.5 and re-check this issue. Let me know how it goes.