image_create_node_from() has a bunch of checks on the file it's given, and if any one of these fails, it just returns FALSE.
We need a way of getting error messages back from this.
The best way seems to me to use form_set_error, and add a parameter for the form element, the same as file_save_upload() has $source.
However, image_create_node_from() is also called from a batch operation -- how can we handle that?
Comments
Comment #1
joachim commentedLooks like we can't do much with errors in batch ops: #363911: Batch API needs to return useful error messages.
So let's just fix this for the cases when it's called from UI.
Comment #2
joachim commentedHmm in which case I'm actually going to say it's sort of moot as IIRC form_set_error doesn't highlight a file field.