How to return back and do not submit form
<p>I am using  multipart to upload a file; I want to prevent the form from being submitted if the file has not been selected.</p>

<p>How can I achieve this ? This is my code:</p>

<pre><code>&lt;form id="uploadFile" name="uploadFileForm" action="&lt;s:url value="/admin/saveExcelDatarestore" /&gt;" method="post" enctype="multipart/form-data"&gt;&lt;span&gt;
    &lt;input type="hidden" name="s360securetoken" value="&lt;s:property value="#session.s360securetoken"/&gt;"/&gt;
    &lt;s:hidden name="user.userId"&gt;&lt;/s:hidden&gt;
    &lt;s:hidden name="user.emailId"&gt;&lt;/s:hidden&gt;
    &lt;div&gt;&lt;label&gt;DownLoad Sample :&lt;/label&gt;&lt;input type="button" class="submit" value="XLS" onclick="dnldSampleData('XLS');"&gt;&lt;/span&gt;&lt;/div&gt;
 &lt;div&gt;&lt;label&gt;Upload File :&lt;/label&gt; &lt;input type="file" name="upload" value="" id="uploadFile_upload"&gt;&lt;/span&gt;

&lt;span&gt;&lt;select id="selectedTimeZone" name="timeZone" style="width:100%;white-space: nowrap; overflow: hidden;" class="chosen-select1"&gt;
 &lt;jsp:include page="../../../../timezone.jsp"/&gt; 
    &lt;/select&gt;&lt;/span&gt;&lt;div&gt;
&lt;input type="submit" value="upload" class="submit" onclick="upload_file();"&gt;&lt;/form&gt;
</code></pre>

<p>Here if I do not select file it's also redirecting tme to <code>saveExecelDatarstore</code>, but I want that if there is no file selected then it shoud not show any message, and return back</p>