uploadDemo.zip
大小:254.39KB
价格:19积分
下载量:0
评分:
5.0
上传者:wx11408115
更新日期:2025-09-22

webUploader Demo源码下载

资源文件列表(大概)

文件名
大小
uploadDemo/
-
uploadDemo/Uploader.swf
139.75KB
uploadDemo/WiFi_Uncle/
-
uploadDemo/WiFi_Uncle_tmp/
-
uploadDemo/css/
-
uploadDemo/css/style.css
8.73KB
uploadDemo/css/webuploader.css
515B
uploadDemo/expressInstall.swf
756B
uploadDemo/favicon.ico
1.39KB
uploadDemo/images/
-
uploadDemo/images/ajax-loader.gif
1.53KB
uploadDemo/images/bg.png
2.78KB
uploadDemo/images/icons.png
2.62KB
uploadDemo/images/image.png
1.63KB
uploadDemo/images/progress.png
1.24KB
uploadDemo/images/success.png
1.58KB
uploadDemo/js/
-
uploadDemo/js/jquery.js
90.42KB
uploadDemo/js/upload.js
19.5KB
uploadDemo/js/webuploader.js
273.62KB
uploadDemo/server/
-
uploadDemo/server/crossdomain.xml
100B
uploadDemo/server/fileupload.php
4.91KB
uploadDemo/server/preview.php
1.79KB
uploadDemo/upload/
-
uploadDemo/upload/index.html
1.39KB

资源内容介绍

web Uploader demo (有修改)百度云及我遇到的问题汇总: https://blog.csdn.net/wx11408115/article/details/70215714
<?php/** * upload.php * * Copyright 2013, Moxiecode Systems AB * Released under GPL License. * * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing */#!! 注意#!! 此文件只是个示例,不要用于真正的产品之中。#!! 不保证代码安全性。#!! IMPORTANT:#!! this file is just an example, it doesn't incorporate any security checks and#!! is not recommended to be used in production environment as it is. Be sure to#!! revise it and customize to your needs.// Make sure file is not cached (as it happens for example on iOS devices)header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");header("Cache-Control: no-store, no-cache, must-revalidate");header("Cache-Control: post-check=0, pre-check=0", false);header("Pragma: no-cache");// Support CORS// header("Access-Control-Allow-Origin: *");// other CORS headers if any...if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS') { exit; // finish preflight CORS requests here}if ( !empty($_REQUEST[ 'debug' ]) ) { $random = rand(0, intval($_REQUEST[ 'debug' ]) ); if ( $random === 0 ) { header("HTTP/1.0 500 Internal Server Error"); exit; }}// header("HTTP/1.0 500 Internal Server Error");// exit;// 5 minutes execution time@set_time_limit(5 * 60);// Uncomment this one to fake upload time// usleep(5000);// Settings// $targetDir = ini_get("upload_tmp_dir") . DIRECTORY_SEPARATOR . "plupload";$targetDir = '../WiFi_Uncle_tmp';$uploadDir = '../WiFi_Uncle';$cleanupTargetDir = true; // Remove old files$maxFileAge = 5 * 3600; // Temp file age in seconds// Create target dirif (!file_exists($targetDir)) { @mkdir($targetDir);}// Create target dirif (!file_exists($uploadDir)) { @mkdir($uploadDir);}@mkdir($uploadDir);// Get a file nameif (isset($_REQUEST["name"])) { $fileName = $_REQUEST["name"];} elseif (!empty($_FILES)) { $fileName = $_FILES["file"]["name"];} else { $fileName = uniqid("file_");}$filePath = $targetDir . DIRECTORY_SEPARATOR . $fileName;$uploadPath = $uploadDir . DIRECTORY_SEPARATOR . $fileName;// Chunking might be enabled$chunk = isset($_REQUEST["chunk"]) ? intval($_REQUEST["chunk"]) : 0;$chunks = isset($_REQUEST["chunks"]) ? intval($_REQUEST["chunks"]) : 1;// Remove old temp filesif ($cleanupTargetDir) { if (!is_dir($targetDir) || !$dir = opendir($targetDir)) { die('{"jsonrpc" : "2.0", "error" : {"code": 100, "message": "Failed to open temp directory."}, "id" : "id"}'); } while (($file = readdir($dir)) !== false) { $tmpfilePath = $targetDir . DIRECTORY_SEPARATOR . $file; // If temp file is current file proceed to the next if ($tmpfilePath == "{$filePath}_{$chunk}.part" || $tmpfilePath == "{$filePath}_{$chunk}.parttmp") { continue; } // Remove temp file if it is older than the max age and is not the current file if (preg_match('/\.(part|parttmp)$/', $file) && (@filemtime($tmpfilePath) < time() - $maxFileAge)) { @unlink($tmpfilePath); } } closedir($dir);}// Open temp fileif (!$out = @fopen("{$filePath}_{$chunk}.parttmp", "wb")) { die('{"jsonrpc" : "2.0", "error" : {"code": 102, "message": "Failed to open output stream."}, "id" : "id"}');}if (!empty($_FILES)) { if ($_FILES["file"]["error"] || !is_uploaded_file($_FILES["file"]["tmp_name"])) { die('{"jsonrpc" : "2.0", "error" : {"code": 103, "message": "Failed to move uploaded file."}, "id" : "id"}'); } // Read binary input stream and append it to temp file if (!$in = @fopen($_FILES["file"]["tmp_name"], "rb")) { die('{"jsonrpc" : "2.0", "error" : {"code": 101, "message": "Failed to open input stream."}, "id" : "id"}'); }} else { if (!$in = @fopen("php://input", "rb")) { die('{"jsonrpc" : "2.0", "error" : {"code": 101, "message": "Failed to open input stream."}, "id" : "id"}'); }}while ($buff = fread($in, 4096)) { fwrite($out, $buff);}@fclose($out);@fclose($in);rename("{$filePath}_{$chunk}.parttmp", "{$filePath}_{$chunk}.part");$index = 0;$done = true;for( $index = 0; $index < $chunks; $index++ ) { if ( !file_exists("{$filePath}_{$index}.part") ) { $done = false; break; }}if ( $done ) { if (!$out = @fopen($uploadPath, "wb")) { die('{"jsonrpc" : "2.0", "error" : {"code": 102, "message": "Failed to open output stream."}, "id" : "id"}'); } if ( flock($out, LOCK_EX) ) { for( $index = 0; $index < $chunks; $index++ ) { if (!$in = @fopen("{$filePath}_{$index}.part", "rb")) { break; } while ($buff = fread($in, 4096)) { fwrite($out, $buff); } @fclose($in); @unlink("{$filePath}_{$index}.part"); } flock($out, LOCK_UN); } @fclose($out);}die($_SESSION['fileName']);

用户评论 (0)

发表评论

captcha

相关资源

软件开发常用图标

软件开发常用图标

12.44MB26积分

spring-framework-2.1-m1

spring-framework-2.1-m1

10.61MB34积分

高仿qq最新安卓版头像裁剪

高仿qq最新安卓版头像裁剪,详情查看csdn博客:http://blog.csdn.net/baiyuliang2013

1.25MB31积分

ExpandableListViewDemo

有时候,使用ListView并不能满足应用程序所需要的功能。有些应用程序需要多组ListView,这时候我们就要使用一种新的控件ExpandableListView——可以扩展的ListView。它的作用就是将ListView进行分组。就好像我们使用QQ的时候,有“我的好友”,“陌生人”,“黑名单”一样,点击一下会扩展开,再点击一下又会收缩回去。ExpandableListView是一个垂直滚动显示两级列表项的视图,与ListView不同的是,它可以有两层:每一层都能够被独立的展开并显示其子项。这些子项来自于与该视图关联的ExpandableListAdapter。每一个可以扩展的列表项的旁边都有一个指示符(箭头)用来说明该列表项目前的状态(这些状态一般是已经扩展开的列表项,还没有扩展开的列表项,子列表项和最后一个子列表项)。可以使用方法:setChildIndicator(Drawable),setGroupIndicator(Drawable)(或者相应的XML文件的属性) 去设置这些指示符的样式。当然也可以使用默认的指示符。布android.R.layout.simple_expandable_list_item_1,android.R.layout.simple_expandable_list_item_2和ListView一样,ExpandableListView也是一个需要Adapter作为桥梁来取得数据的控件。一般适用于ExpandableListView的Adapter都要继承BaseExpandableListAdapter这个类,并且必须重载getGroupView和getChildView这两个最为重要的方法。BaseExpandableListAdapter的主要重载方法如下:public abstract ObjectgetChild (int groupPosition, int childPosition)取得与指定分组、指定子项目关联的数据.参数groupPosition 包含子视图的分组的位置.childPosition 指定的分组中的子视图的位置.返回与子视图关联的数据.public abstract long getChildId (int groupPosition, intchildPosition)取得给定分组中给定子视图的ID. 该组ID必须在组中是唯一的.必须不同于其他所有ID(分组及子项目的ID).参数groupPosition 包含子视图的分组的位置.childPosition 要取得ID的指定的分组中的子视图的位置.返回与子视图关联的ID.public abstract View getChildView (int groupPosition, intchildPosition, boolean isLastChild, View convertView, ViewGroup parent)取得显示给定分组给定子位置的数据用的视图.参数groupPosition 包含要取得子视图的分组位置.childPosition 分组中子视图(要返回的视图)的位置.isLastChild 该视图是否为组中的最后一个视图.convertView 如果可能,重用旧的视图对象.使用前你应该保证视图对象为非空,并且是否是合适的类型.如果该对象不能转换为可以正确显示数据的视图,该方法就创建新视图.不保证使用先前由 getChildView(int, int,boolean, View, ViewGroup)创建的视图.parent 该视图最终从属的父视图.返回指定位置相应的子视图.public abstract int getChildrenCount (int groupPosition)取得指定分组的子元素数.参数groupPosition 要取得子元素个数的分组位置.返回指定分组的子元素个数.public abstract long getCombinedChildId (long groupId, long childId)取得一览中可以唯一识别子条目的 ID(包括分组ID和子条目ID).可扩展列表要求每个条目 (分组条目和子条目)具有一个可以唯一识别列表中子条目和分组条目的ID. 该方法根据给定子条目ID和分组条目ID返回唯一识别ID.另外,如果 hasStableIds() 为真,该函数返回的ID必须是固定不变的.参数groupId 包含子条目ID的分组条目ID.childId 子条目的ID.返回可以在所有分组条目和子条目中唯一识别该子条目的ID(可能是固定不变的).public abstract long getCombinedGroupId (long groupId)取得一览中可以唯一识别子条目的 ID(包括分组ID和子条目ID).可扩展列表要求每个条目 (分组条目和子条目)具有一个可以唯一识别列表中子条目和分组条目的ID. 该方法根据给定子条目ID和分组条目ID返回唯一识别ID.另外,如果 hasStableIds() 为真,该函数返回的ID必须是固定不变的.参数groupId 分组条目ID.返回可以在所有分组条目和子条目中唯一识别该分组条目的ID(可能是固定不变的).public abstract Object getGroup (int groupPosition)取得与给定分组关联的数据.参数groupPosition 分组的位置.返回指定分组的数据.public abstract int getGroupCount ()取得分组数.返回分组数.public abstract long getGroupId (int groupPosition)取得指定分组的ID.该组ID必须在组中是唯一的.必须不同于其他所有ID(分组及子项目的ID).参数groupPosition 要取得ID的分组位置.返回与分组关联的ID.public abstract View getGroupView (int groupPosition, booleanisExpanded, View convertView, ViewGroup parent)取得用于显示给定分组的视图. 这个方法仅返回分组的视图对象, 要想获取子元素的视图对象,就需要调用 getChildView(int, int, boolean, View, ViewGroup).参数groupPosition 决定返回哪个视图的组位置 .isExpanded 该组是展开状态还是收起状态 .convertView 如果可能,重用旧的视图对象.使用前你应该保证视图对象为非空,并且是否是合适的类型.如果该对象不能转换为可以正确显示数据的视图,该方法就创建新视图.不保证使用先前由 getGroupView(int, boolean,View, ViewGroup)创建的视图.parent 该视图最终从属的父视图.返回指定位置相应的组视图.public abstract boolean hasStableIds ()是否指定分组视图及其子视图的ID对应的后台数据改变也会保持该ID.返回是否相同的ID总是指向同一个对象.public abstract boolean isChildSelectable (int groupPosition, intchildPosition)指定位置的子视图是否可选择.参数groupPosition 包含要取得子视图的分组位置.childPosition 分组中子视图的位置.返回是否子视图可选择.注意:在XML布局文件中,如果ExpandableListView上一级视图的大小没有严格定义的话,则不能对ExpandableListView的android:layout_height 属性使用wrap_content值。 (例如,如果上一级视图是ScrollView的话,则不应该指定wrap_content的值,因为它可以是任意的长度。不过,如果ExpandableListView的上一级视图有特定的大小的话,比如100像素,则可以使用wrap_content)如果由于开发的时候粗心,对ExpandableListView指定wrap_content的值,则会报一个在SetContentView处的空指针错误。

438.9KB50积分