File Uploads

Single File

Default By default, file upload element is used to allow users uploading a single file.
 
An example case will be using this element to upload a file to be imported as happens on Hustle and Forminator plugins.
This is a description for files upload element.
<div class="sui-form-field">

	<label class="sui-label">Field label</label>

	<div class="sui-upload sui-file-upload sui-file-browser">

		<input type="file" value="" readonly="readonly" />

		<button class="sui-upload-button"
		<span class="sui-icon-upload-cloud" aria-hidden="true"></span>
			Upload file
		</button>

		<div class="sui-upload-file">

			<span></span>

			<button aria-label="Remove file">
				<span class="sui-icon-close" aria-hidden="true"></span>
			</button>

		</div>

	</div>

	<span class="sui-description">Element description.</span>

	<div class="sui-notice sui-notice-error" style="margin-top: 5px; display: none;">
		<p>Element error message.</p>
	</div>

</div>
Image Preview There are times, when uploading images, that you gonna need to preview the uploaded file reason why you will have to add an extra element into Default file upload element.
 
An example case will be using this element to upload a featured image into your Hustle module.
This is a description for image upload element.
<div class="sui-upload sui-file-upload sui-file-browser">

	<input type="file" ... />

	<!--
	NOTE: Insert the element after input but before upload button.
	-->
	<div class="sui-upload-image" aria-hidden="true">

		<div class="sui-image-mask"></div>

			<!--
			NOTE: Use the uploaded image URL as background image of the div below.
			Leave empty when no file has been uploaded yet.
			-->
			<div
				role="button"
				class="sui-image-preview"
				style="background-image: url();"
			></div>

		</div>

		<button class="sui-upload-button"> ... </button>

	<div class="sui-upload-file"> ... </div>

</div>