I have some code which reads a file through a form field of type file
<input type="file" ... />
I want to give the user another option of providing a url to a file rather than having to upload it as many are already online.
How can I detect when this field is empty on the server side. I am using Apache Commons FileUpload
FileItemStream item = iter.next();
name = item.getFieldName();
stream = item.openStream();
if(!item.isFormField()){
if(item.toString()!=""){
....
I need to detect when item
is empty. The above code doesn't work, nor does using:
if(item.equals(null)){
....