Posts Tagged ‘DropBox’

再说Dropbox

星期四, 10月 15th, 2009

前一段时间接到Dropbox的邮件,说我共享外链流量过大,暂时停止:

Hi Zhang,

This email is an automated notification from Dropbox that your Public links have been temporarily suspended on account of generating excessive traffic. Your Dropbox will continue to function completely normally with the exception of Public links.

If you have any questions, feel free to drop us a line at support@getdropbox.com.

- The Dropbox Team

恩恩,我承认,我用外链的确是过分了一点,甚至用PHP生成Getdropbox公开下载目录文件列表,但被停掉服务毕竟比较不爽。因此略带不客气的口吻发了个邮件:

hi,

my public links have been temporarily suspended, how and when can i user it again?

citywill

两天后收到了署名为Kevin的人工回复,不仅仅恢复了外链服务,而且还为延迟两天才回复邮件而抱歉,并做了解释——他们周一放假啦。

Hi citywill,

Thanks for writing to Dropbox. Sorry for the delay, but Monday was a holiday for us and we’re a little backed up.

Your links are already unbanned. They should be working now.

Regards,
Kevin

这样的回复让我很满意。再此感谢Dropbox一直以来稳定而优异的服务,也谢谢Kevin的回复。再次向大家推荐一下Dropbox,有了它你可以在不同的电脑上保存、同步、共享文件资源。

用PHP生成Getdropbox公开下载目录文件列表

星期二, 4月 21st, 2009

getdropbox总能给人带来惊喜。本以为public下的文件只能通过下载方式发布(多数web服务器都能够做到限制浏览),然而今天才发现,其中的html页面和jpg等图片格式的文件,进而包括所有前端文件,竟然都能通过web直接浏览。这样getdropbox又多了一个用处:方便、免费、最大5G的静态网页空间!(关于getdropbox的介绍:同步存储服务 DropBox 免费奖励扩容最大5G

当然getdropbox的public文件夹主要是用来共享文件的。冗长如 dl.getdropbox.com/u/**** 这样的网址也不太适合发布网站。但我们可以为在public中的文件做一个web索引,帮助使用者快速检索。纯粹的静态开发肯定是不合适的,所以我写了个php脚本,寥寥40行,两个函数用于递归遍历目录和生成索引文件,前端有个用于指定路径的表单。可以为服务端的任意目录生成索引。将生成的文件放到public文件夹下就是这样的:http://dl.getdropbox.com/u/142189/index.htm。当然这个程序稍微修改一下也适合ftp或者本地非服务端目录的检索。

目前我的public不多,慢慢积累中。本期强烈推荐一本电子图书:《100个人的10年(冯骥才)》。小镇村夫对此亦有贡献。

代码如下:

  1. <?php
  2. function get_index ($directory, $i=0) //输出文件列表的html代码
  3. {
  4.     global $file_list;
  5.     $handle = opendir( $directory ); //打开目录
  6.     while ( $file = readdir($handle) ) //遍历循环文件和目录
  7.     {
  8.         $bdir = $directory . / .$file;
  9.         if ($file <> . && $file <> .. && is_dir($bdir)) //如果不是.和 ..并且$bdir是个目录
  10.         {
  11.             get_index($directory ./. $file, $i); //递归
  12.         }
  13.         else if ( $file <> . && $file <> ..) 
  14.         {
  15.             $file_list.= <li><a href=" . substr(substr($directory, $i) ./. $file, 1) . "> . substr(substr($directory, $i) ./. $file, 1) . </a></li>;
  16.         }
  17.     }
  18.     closedir( $handle ); //关闭目录
  19.     return $file_list;
  20. }
  21.  
  22. function make_file($content, $filename=index.htm) //生成列表文件
  23. {
  24.     $fp = fopen($filename,w);
  25.     fwrite($fp, $content);
  26.     fclose($fp);
  27.     header(location: . $filename);
  28. }
  29.  
  30. if($_GET['action']==make)
  31. {
  32.     $dir=$_POST['dir']?$_POST['dir']:dirname(__FILE__); //指定路径
  33.     make_file(get_index($dir,strlen($dir))); //生成文件
  34. }
  35.  
  36. echo 
  37.     <form method="post" action="?action=make">
  38.     输入路径:<input type="text" name="dir" />
  39.     <input type="submit" value="确定" />
  40.     </form>
  41. ;

也可以到这里直接下载文件,嗯,PHP文件当然必须是可以直接下载的。

同步存储服务 DropBox 免费奖励扩容最大5G

星期一, 3月 16th, 2009

dropbox是我最喜欢也是使用最持久的网络存储服务。特别之处是,dropbox支持用户在不同的电脑以本地文件夹方式自动同步数据。例如A、B两台(也可以多台)电脑需要同步和网络存储大量文件,用户只要在两台电脑都安装dropbox的客户端,并分别指定a、b文件夹,这样用户在使用A电脑时只要将需要备份或更新的文件拖到a文件夹,文件就会自动更新上传。等用户打开B电脑时,b文件夹中的文件会将更新内容下载。这样A、B两台机器上的相应文件夹就可以达到同步更新和网络存储的双重目的。

dropbox文件上传下载速度也很不错,而且上传和下载过程不用等待,通常不知不觉中就完成了。至于文件更新版本的识别上,我用了这么久还没有出现过旧版本覆盖新版本的问题。甚至有一段时间我将apache的htdocs文件夹映射到dropbox的文件夹,这样dropbox还可以做为简单的版本控制来用,爽得不行。

目前dropbox推出了推荐用户升级空间的活动,最多由正常2G升级到5G。其实使了这么长时间,应该快有一年了,我才用了1G还不到,升级不算急迫,更多还是分享。毕竟用的人越多,dropbox夭折的可能性就会小一点。

我的推荐地址是:https://www.getdropbox.com/referrals/NTE0MjE4OTk 大家都来注册吧!