Skip to content

A JavaScript library to preview images before uploading them.

Notifications You must be signed in to change notification settings

catarxis-technologies/upload-preview

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

upload-preview

This library uses the File API to read an image and show its preview.

Options

  • inputSelector: The selector for the input element.
  • previewSelector: The selector for the preview container.
  • imgClass: The CSS class for the preview image.

Usage

For example:

HTML

<form>
    <div class="form-group">
        <label class="control-label" for="file">Photo</label>
        <input id="file" name="file" type="file">
        <span class="help-block hidden"></span>
    </div>
    <div id="preview" class="form-group"></div>
</form>

JavaScript

var preview = new UploadPreview({
    inputSelector: '#file',
    previewSelector: '#preview',
    imgClass: 'preview'
});

About

A JavaScript library to preview images before uploading them.

Resources

Stars

Watchers

Forks

Packages

No packages published