Coder Social home page Coder Social logo

flex-uploader's Introduction

Flex Uploader

Flex Uploader is a simple file uploader component with a flexible design. It allows users to upload images easily. This README provides an overview of the HTML structure and how to initialize the uploader using JavaScript.

Usage

  1. Include the necessary CSS and JavaScript files in your HTML document:

    <!DOCTYPE html>
    <html lang="en">
    
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>Flex Uploader</title>
    
        <style>
            body {
                margin: 0;
                padding: 1rem;
                font-family: sans-serif;
            }
        </style>
    
        <link rel="stylesheet" href="/dist/css/flex-uploader.css">
    
        <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.8.0/styles/default.min.css">
    
    </head>
    
    <body>
        <!-- Your HTML content here -->
    
        <script src="/dist/js/flex-uploader.js"></script>
    
        <script>
            // init uploader
            new FlexUploader("drop-area", "input-file", "img-view");
        </script>
    
        <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.8.0/highlight.min.js"></script>
    
        <script>
            hljs.highlightAll();
        </script>
    </body>
    
    </html>
  2. Add the following HTML structure for the file uploader:

    <p>Example:</p>
    <label for="input-file" id="drop-area" class="drop-area">
        <input type="file" name="image" id="input-file" accept="image/*" hidden>
        <div id="img-view" class="img-view">
            <img src="../dist/images/gallery-export.svg" id="img" width="50">
            <p id="img-info">Choose Image To Upload</p>
        </div>
    </label>
  3. Include the following HTML snippet for reference in your documentation:

    <p>HTML:</p>
    <pre><code class="html">&lt;label for="input-file" id="change-this-drop-area" class="drop-area"&gt;
        &lt;input type="file" name="image" id="change-this-input-file" accept="image/*" hidden&gt;
        &lt;div id="change-this-img-view" class="img-view"&gt;
            &lt;img src="../dist/images/gallery-export.svg" id="img" width="50"&gt;
            &lt;p id="img-info"&gt;Choose Image To Upload&lt;/p&gt;
        &lt;/div&gt;
    &lt;/label&gt;</code></pre>
  4. Initialize the Flex Uploader in your JavaScript:

    <p>JS:</p>
    <pre><code class="js">new FlexUploader("drop-area", "input-file", "img-view");</code></pre>

License

This project is licensed under the MIT License.

flex-uploader's People

Contributors

xrafffcode avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.