UGiA PHP UPLOADER V0.2
  
  利用php上传比较大的文件时,往往需要很长的等待时间,而且受网络和软件等的影响,经常会出现超时及上传失败的现象。如何在上传文件时实时的得到文件上传进度,以及如何避开php和其他因素的限制上传任意大小的文件呢?
  
  php同asp等其他语言对上传文件的处理方式不同,asp中可以用Request.BinaryRead流式的读取客户端提交的数据。php是把文件存放在临时文件夹中,在文件上传完成后才能够获取其信息以及对其进行操作。如果在上传过程中我们能够得到其临时文件的文件名,我们就可以通过判断临时文件的大小来来得到上传进度,不过好像没有办法得到。所以我们只能通过其他方式,就是利用php的socket扩展建立一个简单的服务器,把数据post到这个服务器上,然后再用我们自己的机制来处理。
  
  先说说流程,首先用php的socket函数库建立一个临时的http服务器,在某一端口监听,然后把ip地址和端口号通知客户端,客户端把上传表单提交到http://srvIpAddress:port(临时服务器), 临时服务器接受客户端请求,并读取post数据,分析并获取客户端上传的文件信息,把文件保存在服务器上,然后关闭临时服务器,释放资源,上传完成。 有点绕,不过思路还是简单的。
  
  UPU V0.2功能列表
  - 理论上可以上传无限大的文件
  - 实时显示上传状态、进度
  - 支持多文件上传以及与表单混合上传
  - 方便的用户调用接口
  - 兼容不同浏览器
  - …
  
  调用方法:
  1.下载upub0.2.rar, 将里面的upu目录解压到网站某一目录下。将upu/temp/, upu/files的目录权限改为755
  2.打开upu/misc/upu.js, 修改var basePath = "/upload/upu/"; 为upu相对于网站根目录的路径
  3.在包含上传表单的页面中加入,这里的upu/misc/upu.js为upu.js的路径,然后在
标签中加入onsubmit="return upuInit(this)"
  4.在你文件上传后处理的页面中使用$_POST来获取表单数据
  
  注意:
  1. UPU需要php4.3.0及其以上版本,并打开socket扩展,因为上传过程中需要开临时端口,请注意一下服务器的防火墙设置。
  2. upu/temp为上传临时文件存放目录, upu/files为文件存放目录,这两个目录可以在upu.class.php中指定。
  3. 你的中要有enctype="multipart/form-data"这个属性,action为文件上传成功后的处理页面,也就是说你的完全按照正常的思路来写就可以了,唯一不同的是需要加入onsubmit="return upuInit(this)"
  4. 上传成功后,可以使用$_POST来获取表单数据,如果是普通表单,直接$_POST[’表单名称’]即可获得其值,如果是一个文件,则返回这样一个数组
  $_POST[’表单名字’] = Array (
  [filename] => 文件名
  [clientpath] => 客户端文件路径
  [savepath] => 上传后文件保存路径及文件名
  [filetype] => 文件类型
  [filesize] => 文件大小
  [extension] => 扩展名
  )
  
  5. 本程序为自由软件;您可依据自由软件基金会所发表的GNU通用公共授权条款规定,就本程序再为发布与/或修改.本程序是基于使用目的而加以发布,然而不负任何担保责任;亦无对适售性或特定目的适用性所为的默示性担保。详情请参照GNU通用公共授权。http://gnu.freehostingguru.com/gpl/
  
  下载地址:UGiA PHP UPLOADER V0.2




电脑杂谈 | 评论(13) | 引用(0) | 阅读(21702)
louis vuitton uk Email Homepage
2011-11-23 09:25
This louis vuitton uk for sale belongs to the sounding just what are termed as Louis Vuitton vintage best sellers, many other products and services for the reason that range appearing companies.You will easily notice the unfold zippers of this coach outlet store online. That is the decoration. There are some inside pockets for you as well. They are easy to match your clothes and to carry.Let us inspire your inner beauty with fine christian louboutin sale. Purse the elegance in bridal wedding. Enjoy the fashion.
baozang
2012-9-22 13:33
Lamo - Like Sebago, Louis Vuitton Canada  there are only about 40 styles of Lamo Footwear. Most of their footwear uses a suede leather traditional in True Religion Jeans  moccasins, though only about 1/3 of the footwear collection is a traditional moccasin look. True Religion Brand Jeans The rest of the collection is slippers and UGG styled boots.Louis Vuitton Artsy The traditional moccasins do have a soft rubber sole making them great deck True Religion Sale shoes as well, however. Expect to pay between $50 and $60 for Lamo moccasins.  Invicta watches have been here since 1837. They were made by Raphael Picard. Invicta watches got its name from a Latin word. The meaning of Invicta in Louis Vuitton Monogram Vernis Alma BB Amarante Latin is "Invincible". Earlier these watches were not so popular but recently with its new men's collection this watch brand has gained a lot of popularity. Watches for many are a style statement and so they prefer to own the best piece. Invicta watches are popular as they are like a style statement.
让他 Email Homepage
2012-11-28 16:04
../8531
Jane Austen Email
2015-10-19 11:51
有点绕,不过思路还是简单的。

replica handbags uk | longchamp outlet online | chanel replica handbags
desy Email
2017-3-7 12:30
best alkaline water machines 2019 Email Homepage
2019-1-5 21:30
It is very important for everybody to consume as much as water in a day! Water being a universal solvent, it helps in many internal functions of the body.best alkaline water machines 2019   |alkaline water machine
happy wheels Email Homepage
2020-3-23 15:52
I do not know what to say really what you share very well and useful to the community, I feel that it makes our community much more developed, thanks run 3
分页: 1/1 第一页 1 最后页
发表评论
表情
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
打开HTML
打开UBB
打开表情
隐藏
记住我
昵称   密码   游客无需密码
网址   电邮   [注册]