• 大小: 20.02MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-07-04
  • 语言: Html/CSS
  • 标签: angularjs  jquery  html5  

资源简介

angularjs+html5+源码,页面30几个,全英文angularjs+html5+源码,页面30几个,全英文angularjs+html5+源码,页面30几个,全英文

资源截图

代码片段和文件信息

# -*- coding: utf-8 -*-
#
# jQuery File Upload Plugin GAE Python Example 2.2.0
# https://github.com/blueimp/jQuery-File-Upload
#
# Copyright 2011 Sebastian Tschan
# https://blueimp.net
#
# Licensed under the MIT license:
# http://www.opensource.org/licenses/MIT
#

from __future__ import with_statement
from google.appengine.api import files images
from google.appengine.ext import blobstore deferred
from google.appengine.ext.webapp import blobstore_handlers
import json
import re
import urllib
import webapp2

WEBSITE = ‘https://blueimp.github.io/jQuery-File-Upload/‘
MIN_FILE_SIZE = 1  # bytes
MAX_FILE_SIZE = 5000000  # bytes
IMAGE_TYPES = re.compile(‘image/(gif|p?jpeg|(x-)?png)‘)
ACCEPT_FILE_TYPES = IMAGE_TYPES
THUMBNAIL_MODIFICATOR = ‘=s80‘  # max width / height
EXPIRATION_TIME = 300  # seconds


def cleanup(blob_keys):
    blobstore.delete(blob_keys)


class UploadHandler(webapp2.RequestHandler):

    def initialize(self request response):
        super(UploadHandler self).initialize(request response)
        self.response.headers[‘Access-Control-Allow-Origin‘] = ‘*‘
        self.response.headers[
            ‘Access-Control-Allow-Methods‘
        ] = ‘OPTIONS HEAD GET POST PUT DELETE‘
        self.response.headers[
            ‘Access-Control-Allow-Headers‘
        ] = ‘Content-Type Content-Range Content-Disposition‘

    def validate(self file):
        if file[‘size‘] < MIN_FILE_SIZE:
            file[‘error‘] = ‘File is too small‘
        elif file[‘size‘] > MAX_FILE_SIZE:
            file[‘error‘] = ‘File is too big‘
        elif not ACCEPT_FILE_TYPES.match(file[‘type‘]):
            file[‘error‘] = ‘Filetype not allowed‘
        else:
            return True
        return False

    def get_file_size(self file):
        file.seek(0 2)  # Seek to the end of the file
        size = file.tell()  # Get the position of EOF
        file.seek(0)  # Reset the file position to the beginning
        return size

    def write_blob(self data info):
        blob = files.blobstore.create(
            mime_type=info[‘type‘]
            _blobinfo_uploaded_filename=info[‘name‘]
        )
        with files.open(blob ‘a‘) as f:
            f.write(data)
        files.finalize(blob)
        return files.blobstore.get_blob_key(blob)

    def handle_upload(self):
        results = []
        blob_keys = []
        for name fieldStorage in self.request.POST.items():
            if type(fieldStorage) is unicode:
                continue
            result = {}
            result[‘name‘] = re.sub(
                r‘^.*\\‘
                ‘‘
                fieldStorage.filename
            )
            result[‘type‘] = fieldStorage.type
            result[‘size‘] = self.get_file_size(fieldStorage.file)
            if self.validate(result):
                blob_key = str(
                    self.write_blob(fieldStorage.value result)
                )
                blob_keys.append(blob_key)
                result[‘deleteType‘] = ‘DELET

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2015-03-14 00:25  clip-two_v1.2.1\
     目录           0  2015-03-14 00:25  clip-two_v1.2.1\AngularJs-Admin\
     目录           0  2015-03-14 00:25  clip-two_v1.2.1\AngularJs-Admin\Documentation\
     目录           0  2015-03-14 00:25  clip-two_v1.2.1\AngularJs-Admin\Documentation\assets\
     目录           0  2015-03-14 00:25  clip-two_v1.2.1\AngularJs-Admin\Documentation\assets\css\
     文件      113498  2015-02-26 00:08  clip-two_v1.2.1\AngularJs-Admin\Documentation\assets\css\bootstrap.min.css
     文件         604  2015-02-26 00:08  clip-two_v1.2.1\AngularJs-Admin\Documentation\assets\css\doc.css
     文件      291444  2015-02-26 00:08  clip-two_v1.2.1\AngularJs-Admin\Documentation\assets\css\styles.css
     目录           0  2015-03-14 00:25  clip-two_v1.2.1\AngularJs-Admin\Documentation\assets\js\
     文件         325  2015-02-26 00:08  clip-two_v1.2.1\AngularJs-Admin\Documentation\assets\js\custom.js
     文件       96383  2015-02-26 00:08  clip-two_v1.2.1\AngularJs-Admin\Documentation\assets\js\jquery.js
     文件        2681  2015-02-26 00:08  clip-two_v1.2.1\AngularJs-Admin\Documentation\assets\js\jquery.scrollTo.min.js
     文件       73004  2015-03-14 00:24  clip-two_v1.2.1\AngularJs-Admin\Documentation\documentation.html
     目录           0  2015-03-14 00:25  clip-two_v1.2.1\AngularJs-Admin\RTL\
     目录           0  2015-03-14 00:25  clip-two_v1.2.1\AngularJs-Admin\RTL\assets\
     目录           0  2015-03-14 00:25  clip-two_v1.2.1\AngularJs-Admin\RTL\assets\api\
     文件         207  2015-03-13 19:56  clip-two_v1.2.1\AngularJs-Admin\RTL\assets\api\groups.js
     目录           0  2015-03-14 00:25  clip-two_v1.2.1\AngularJs-Admin\RTL\assets\css\
     文件       17968  2015-03-13 19:56  clip-two_v1.2.1\AngularJs-Admin\RTL\assets\css\animate.css
     文件       12085  2015-03-13 20:01  clip-two_v1.2.1\AngularJs-Admin\RTL\assets\css\plugins.css
     文件      391842  2015-03-13 20:01  clip-two_v1.2.1\AngularJs-Admin\RTL\assets\css\rtl.css
     文件      291624  2015-03-13 20:01  clip-two_v1.2.1\AngularJs-Admin\RTL\assets\css\styles.css
     目录           0  2015-03-14 00:25  clip-two_v1.2.1\AngularJs-Admin\RTL\assets\css\themes\
     文件       11329  2015-03-13 20:01  clip-two_v1.2.1\AngularJs-Admin\RTL\assets\css\themes\theme-1.css
     文件       11308  2015-03-13 20:01  clip-two_v1.2.1\AngularJs-Admin\RTL\assets\css\themes\theme-2.css
     文件       11457  2015-03-13 20:01  clip-two_v1.2.1\AngularJs-Admin\RTL\assets\css\themes\theme-3.css
     文件       11380  2015-03-13 20:01  clip-two_v1.2.1\AngularJs-Admin\RTL\assets\css\themes\theme-4.css
     文件       11687  2015-03-13 20:01  clip-two_v1.2.1\AngularJs-Admin\RTL\assets\css\themes\theme-5.css
     文件       11304  2015-03-13 20:01  clip-two_v1.2.1\AngularJs-Admin\RTL\assets\css\themes\theme-6.css
     目录           0  2015-03-14 00:25  clip-two_v1.2.1\AngularJs-Admin\RTL\assets\fonts\
     文件       15736  2015-03-13 19:56  clip-two_v1.2.1\AngularJs-Admin\RTL\assets\fonts\clip-two.eot
............此处省略5659个文件信息

评论

共有 条评论