IOS7 's nsurlsession simplifies nsurlconnection file uploads and downloads, and this article records how to configure the WebDAV service to support put-style file uploads.
I. Configuring a WebDAV Server
1. Modify Httpd.conf
1> Open the terminal, and then enter:
cd/etc/apache2/
sudo vi httpd.conf
2> Input in VI
/httpd-dav.conf
Find httpd-dav.conf
3> the line's first # comment Delete
4> Save and exit
Input
: Wq
2. Modify Httpd-dav.conf
1> is entered in the terminal:
Cd/etc/apache2/extra
sudo vi httpd-dav.conf
2> Modify the contents of the httpd-dav.conf according to the following content
Hint: Only the authorization type and user password files have been modified two locations
Davlockdb "/usr/var/davlock"
alias/uploads "/usr/uploads"
<directory "/usr/uploads" >
Dav
on Order Allow,deny
Allow from all
#用户的授权类型
authtype Basic
authname dav-upload
# and can use the Htdigest to create the password database:
# Htdigest-c "/usr/user.passwd" dav-upload admin
# User Password File
authuserfile "/usr/webdav.passwd"
authdigestprovider file
# Allow Universal read-access, but writes are restricted
<limitexcept get options>
require user admin
</LimitExcept>
</ Directory>
Description
According to the above configuration file, you can upload the file to the/usr/uploads directory via url->http://localhost/uploads
The user name used to upload the file is: admin
3> Save and exit
Input
: Wq
3. Create folders and configure files
1> Create the admin password and enter it in the terminal:
sudo htpasswd-c/usr/webdav.passwd admin
Then enter the admin password, the password file will be saved in the/USR/WEBDAV.PASSWD