본문 바로가기
웹 코딩/HTML + CSS

업로드 허용 확장자 지정하기

by 알릭2 2020. 8. 10.

파일 올리기 할 때 이미지만 받는다던지, 엑셀만 받는다던지...

 

 

확장자를 지정해서 미리 차단할 수 있음

 

<p>Show .xls, .xlsx, .csv files...</p>
<input type="file" accept=".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel" ID="fileSelect" runat="server" />  

<p>Only show Excel (.xlsx) files...</p>
<input type="file" accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" ID="fileSelect" runat="server" />  

<p>Only show Excel (.xls) files...</p>
<input type="file" accept="application/vnd.ms-excel" ID="fileSelect" runat="server" />  

<p>Only show image files...</p>
<input type="file" accept="image/*" ID="fileSelect" runat="server" />  

<p>Only show text files...</p>
<input type="file" accept="text/plain" ID="fileSelect" runat="server" />  

<p>Only show html files...</p>
<input type="file" accept="text/html" ID="fileSelect" runat="server" />  

<p>Only show video files...</p>
<input type="file" accept="video/*" ID="fileSelect" runat="server" />  

<p>Only show audio files...</p>
<input type="file" accept="audio/*" ID="fileSelect" runat="server" />  

<p>Only show .WAV files...</p>
<input type="file" accept=".wav" ID="fileSelect" runat="server" />  

<p>Only show .PDF files...</p>
<input type="file" accept=".pdf" ID="fileSelect" runat="server" /> 

댓글