iBarn-master.zip
iBarn-master.zip
代码片段和文件信息
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2018-02-14 22:17 iBarn-master
目录 0 2017-12-28 18:50 iBarn-masteraction
文件 5032 2017-12-28 18:50 iBarn-masteractionCollection.class.php
文件 37868 2017-12-28 18:50 iBarn-masteractionCore.class.php
文件 4610 2017-12-28 18:50 iBarn-masteractionInstall.class.php
文件 12852 2017-12-28 18:50 iBarn-masteractionShare.class.php
文件 7697 2017-12-28 18:50 iBarn-masteractionUser.class.php
目录 0 2017-12-28 18:50 iBarn-masterconf
文件 171 2017-12-28 18:50 iBarn-masterconfcode.php
文件 2957 2017-12-28 18:50 iBarn-masterconfconfig.php
文件 659 2017-12-28 18:50 iBarn-masterconffilter.php
目录 0 2017-12-28 18:50 iBarn-masterconflang
文件 5575 2017-12-28 18:50 iBarn-masterconflanglang.php
文件 4062 2017-12-28 18:50 iBarn-masterconflang ipLang.php
文件 3642 2017-12-28 18:50 iBarn-masterconfmime.php
文件 148 2017-12-28 18:50 iBarn-masterconfupload.php
目录 0 2017-12-28 18:50 iBarn-masterdata
文件 73 2017-12-28 18:50 iBarn-masterdata.gitignore
目录 0 2017-12-28 18:50 iBarn-masterhtml
文件 7056 2017-12-28 18:50 iBarn-masterhtmlavatar.php
文件 12070 2017-12-28 18:50 iBarn-masterhtmlcollection.php
文件 1526 2017-12-28 18:50 iBarn-masterhtmlerror.php
文件 424 2017-12-28 18:50 iBarn-masterhtmlfoot.php
文件 9438 2017-12-28 18:50 iBarn-masterhtmlhead.php
文件 44169 2017-12-28 18:50 iBarn-masterhtmlindex.php
文件 6311 2017-12-28 18:50 iBarn-masterhtmlinstall.php
文件 4808 2017-12-28 18:50 iBarn-masterhtmllogin.php
文件 15853 2017-12-28 18:50 iBarn-masterhtmlmyshare.php
文件 12678 2017-12-28 18:50 iBarn-masterhtmloffer.php
文件 11823 2017-12-28 18:50 iBarn-masterhtmlown.php
文件 11829 2017-12-28 18:50 iBarn-masterhtmlpay.php
............此处省略2309个文件信息
# -*- coding: utf-8 -*-
#
# jQuery File Upload Plugin GAE Python Example 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 re urllib webapp2
WEBSITE = ‘http://blueimp.github.com/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‘
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[‘delete_type‘] = ‘DELETE‘
result[‘delete_url‘] = self.request.host_url +
‘/?key=‘ + urllib.quote(blob_key ‘‘)
if (IMAGE_TYPES.match(result[‘type‘])):
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2018-02-14 22:17 iBarn-master
目录 0 2017-12-28 18:50 iBarn-masteraction
文件 5032 2017-12-28 18:50 iBarn-masteractionCollection.class.php
文件 37868 2017-12-28 18:50 iBarn-masteractionCore.class.php
文件 4610 2017-12-28 18:50 iBarn-masteractionInstall.class.php
文件 12852 2017-12-28 18:50 iBarn-masteractionShare.class.php
文件 7697 2017-12-28 18:50 iBarn-masteractionUser.class.php
目录 0 2017-12-28 18:50 iBarn-masterconf
文件 171 2017-12-28 18:50 iBarn-masterconfcode.php
文件 2957 2017-12-28 18:50 iBarn-masterconfconfig.php
文件 659 2017-12-28 18:50 iBarn-masterconffilter.php
目录 0 2017-12-28 18:50 iBarn-masterconflang
文件 5575 2017-12-28 18:50 iBarn-masterconflanglang.php
文件 4062 2017-12-28 18:50 iBarn-masterconflang ipLang.php
文件 3642 2017-12-28 18:50 iBarn-masterconfmime.php
文件 148 2017-12-28 18:50 iBarn-masterconfupload.php
目录 0 2017-12-28 18:50 iBarn-masterdata
文件 73 2017-12-28 18:50 iBarn-masterdata.gitignore
目录 0 2017-12-28 18:50 iBarn-masterhtml
文件 7056 2017-12-28 18:50 iBarn-masterhtmlavatar.php
文件 12070 2017-12-28 18:50 iBarn-masterhtmlcollection.php
文件 1526 2017-12-28 18:50 iBarn-masterhtmlerror.php
文件 424 2017-12-28 18:50 iBarn-masterhtmlfoot.php
文件 9438 2017-12-28 18:50 iBarn-masterhtmlhead.php
文件 44169 2017-12-28 18:50 iBarn-masterhtmlindex.php
文件 6311 2017-12-28 18:50 iBarn-masterhtmlinstall.php
文件 4808 2017-12-28 18:50 iBarn-masterhtmllogin.php
文件 15853 2017-12-28 18:50 iBarn-masterhtmlmyshare.php
文件 12678 2017-12-28 18:50 iBarn-masterhtmloffer.php
文件 11823 2017-12-28 18:50 iBarn-masterhtmlown.php
文件 11829 2017-12-28 18:50 iBarn-masterhtmlpay.php
............此处省略2309个文件信息
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。
评论列表(条)