使用curl从apache服务器上传下载文件

上一篇 / 下一篇  2011-03-22 23:49:18 / 个人分类:解决方案

服务器是fedora+apache2

1、关闭防火墙!!!(iptables、selinux),否则会权限不够。
2、在网页文件夹/var/www/html下建立一个文件夹files,并修改其权限为777
3、修改/etc/httpd/conf/httpd.conf
<Directory "/var/www/html/files">
    Dav On
    AllowOverride None
    Options All
    Order allow,deny
    Allow from all
</Directory>
就可以向/var/www/html/files写文件了
4、修改操作路径
修改/etc/httpd/conf/httpd.conf
将DocumentRoot 和Directory 两行的文件夹都修改为新的文件夹路径即可。
5、使用命令如下:
对于单个文件来说:
从服务器files文件夹中下载一个名为hello的文件,在本地保存为h(默认保存在当前操作文件夹下)
curl -o h http://服务器IP/files/hello
下载文件,保存为为原文件名
curl -O http://服务器IP/files/hello
将本地当前文件夹下的文件h上传至服务器files文件夹中    
curl -T h http://服务器IP/files/

对于多个文件同时,可以使用一条语句:
curl -O http://服务器IP/files/img[1-1000].png

curl -T "img[1-1000].png" http://服务器IP/files/








TAG:

 

评分:0

我来说两句

我的栏目

日历

« 2024-04-26  
 123456
78910111213
14151617181920
21222324252627
282930    

数据统计

  • 访问量: 30564
  • 日志数: 22
  • 图片数: 3
  • 建立时间: 2011-03-09
  • 更新时间: 2011-05-17

RSS订阅

Open Toolbar