Empty File Upload Showing in XML
This is an open discussion with 8 replies, filed under Troubleshooting.
Search
I don’t know how to prevent a blank field from appearing in the XML, but you can have your XSL ignore null values in the XML.
I’m not sure if that is intended behavior. But wisolman is correct, the XPath to select only attachments that have filenames would be something like:
/data/your-data-source/attachment[filename/node()]
I find that even if I have left the field blank, Sym still outputs the item in XML, but with an empty filename
This is definitely a bug. Could you post a report on the Issues tracker please?
Fixed it here. Mind if you check?
@ashooner and wisolman
I had not though of that, it will provide a temporary fix. Thanks.
@brendo
I tried adding the line, but still get the above XML outputted. I tried updating the entry, and also created a new every, but still got the same result.
Thanks.
I have added an Issue here: http://getsymphony.com/discuss/issues/view/375/
@brendo I had a look at the value of $data in line 179, it was as follows.
Array ( [file] => [size] => [mimetype] => [meta] => )
I then tried the following, the fix you suggested, but modified to this:
if (!is_array($data) or empty($data['file'])) return;
and the problem was resolved! I doubt the above is ideal. I don’t know enough to know how to fix it.
Thanks.
Issue fixed:
http://getsymphony.com/discuss/issues/view/375/
Thanks Alistair!
Create an account or sign in to comment.
I have just updated to Sym 2.1, but am getting the following bug/problem.
I have a field called ‘attachment’, which is a File Upload field. It is set to optional. However, I find that even if I have left the field blank, Sym still outputs the item in XML, but with an empty filename, as below. This did not use to happen before updating.
Your help would be appreciated.
Thanks, Nathanael