<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>The Townes &#187; SAE上传文件</title>
	<atom:link href="https://thetownes.coolpage.biz/?feed=rss2&#038;tag=sae%E4%B8%8A%E4%BC%A0%E6%96%87%E4%BB%B6" rel="self" type="application/rss+xml" />
	<link>https://thetownes.coolpage.biz</link>
	<description>本站已转移至：http://www.thetownes.info</description>
	<lastBuildDate>Thu, 01 Aug 2013 11:49:56 +0000</lastBuildDate>
	<language>zh-CN</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.2</generator>
		<item>
		<title>SAE上传文件到SaeStorage代码</title>
		<link>https://thetownes.coolpage.biz/?p=383</link>
		<comments>https://thetownes.coolpage.biz/?p=383#comments</comments>
		<pubDate>Sat, 13 Jul 2013 14:58:11 +0000</pubDate>
		<dc:creator>Will</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[SaeStorage代码]]></category>
		<category><![CDATA[SAE上传文件]]></category>

		<guid isPermaLink="false">http://thetownes.coolpage.biz/?p=383</guid>
		<description><![CDATA[首先这是表单： &#60;html&#62; &#60;head&#62; &#60;ti &#8230; <a href="https://thetownes.coolpage.biz/?p=383">继续阅读 <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<pre>首先这是表单：</pre>
<pre>&lt;html&gt;

&lt;head&gt;
&lt;title&gt;Upload&lt;/title&gt;
&lt;meta http-equiv=”Content-Type” content=”text/html;charset=utf-8″ /&gt;
&lt;/head&gt;

&lt;body&gt;
&lt;br&gt;
&lt;form enctype="multipart/form-data" action="upload.php" method="post"&gt;
&lt;label for="file"&gt;Filename:&lt;/label&gt;
&lt;input type="file" name="file" id="file" /&gt;
&lt;br /&gt;
&lt;input type="submit" name="submit" value="submit" /&gt;
&lt;/form&gt;
存储遍历查找：&lt;a href="bianli.php"&gt;Start&lt;/a&gt;
&lt;/body&gt;
&lt;/html&gt;</pre>
<pre>其次是上传文件：</pre>
<pre>&lt;?php
$s=new saestorage();
$name=$_FILES['file']['name'];
echo $s-&gt;upload('sc',$name,$_FILES['file']['tmp_name']);
echo $s-&gt;getUrl('sc', $name);
echo '&lt;br/&gt;';
?&gt;</pre>
<pre>具体见这个：<a href="http://apidoc.sinaapp.com/sae/SaeStorage.html">http://apidoc.sinaapp.com/sae/SaeStorage.html</a></pre>
<pre>再来就是遍历查找：</pre>
<pre>&lt;?php
//遍历Domain下所有文件
$stor = new SaeStorage();

$num = 0;
while ( $ret = $stor-&gt;getList("sc", "*", 100, $num ) ) {
        foreach($ret as $file) {
            echo "文件名称：  {$file}n";
			echo "文件地址：  {$stor-&gt;getUrl('sc',$file)}n";
			echo "&lt;br/&gt;&lt;br/&gt;";
            $num ++;
        }
}
echo "&lt;br/&gt;";
echo "nTOTAL: {$num} filesn";
?&gt;</pre>
]]></content:encoded>
			<wfw:commentRss>https://thetownes.coolpage.biz/?feed=rss2&#038;p=383</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
