Git Product home page Git Product logo

ajax_file_upload's Introduction

Ajax_File_Upload

Introduction

利用 javascript 達到檔案上傳的功能

Release

Beta(Now is prototype)

Feature

  • 顯示上傳進度
  • 多檔上傳
  • 取消上傳
  • 拖拉上傳
  • 斷點續傳??
  • chrome 上傳資料夾
  • 盡可能跨 browser(for IE8)
  • 不依攋任一 javascript library

Develop

  • 單純用 javascript
  • 利用 AJAX 上傳
  • 處理 AJAX 上傳在 IE 的問題(利用 iframe 也許可解, Refer)
  • 處理拖拉
  • 處理拖拉資料夾
  • 處理預設樣式

DevLog

Log & note

Issue

  • FormData
    • AJAX 上傳(IE10 以上)
    • IE 利用 iframe 實作

Usage

var upload = new uploadFiles(
    {
        inputFileSelector: '#select',
        fileName: 'Upfile[]'
    }
);

Parameter

  • inputFileSelector(input type file element)
  • fileName(name="")
  • server(the file upload to server url)
  • dropArea(set the drop area)

Method

  • upload
  • cancel

Event

Use CustomEvent (IE 9 up) Refer - How to Create Custom Events in JavaScript

  • selectFiles
    • e.fileList (Array)
      • name
      • size
      • type
    • e.length (number)
  • uploadError
  • uploadProgress
    • e.bytesLoaded (number)
    • e.bytesTotal (number)
    • e.percentLoaded (number)
  • uploadComplete
  • dragenter
  • dragover
  • drop
  • drag

About code

Get DOM use querySelector replace getElementById、getElementsByTagName...etc(IE8 up) document.querySelector Use node method to reduce code

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.