0

我正在尝试找到一种方法来做到这一点。到目前为止,由于 cookie 参数,我已经能够访问页面:

 curl -v --cookie cookies.txt --cookie-jar cookies.txt --user-agent Mozilla/4.0 --data "u=login&p=passwd" http://wiki/doku.php?id=start&do=login

接着

 curl --cookie  cookies.txt  http://wiki/doku.php?id=info

要上传文件,我应该在 php 页面上获取表单参数。我不完全知道我在寻找什么:

curl --form "file=@z.xml" --cookie cookies.txt "http://wiki/doku.php?id=start&tab_files=upload&do=media"
4

1 回答 1

0

我让它以不同的方式工作。我创建了一个 upload.php 文件(

<?php

$uploaddir = '/var/www/html/dokuwiki/upload/';
$uploadfile = $uploaddir . basename($_FILES['upload']['name']);

echo "<p>";

if (move_uploaded_file($_FILES['upload']['tmp_name'], $uploadfile)) {
  echo "File is valid, and was successfully uploaded.\n";
} else {
   echo "Upload failed";
}

echo "</p>";
echo '<pre>';
echo 'Here is some more debugging info:';
print_r($_FILES);
print "</pre>";

?>

和 curl 命令(source

curl --form upload=@file --form press=OK http://wiki/upload/upload.php

最后,我允许了一些主机httpd.conf

<Directory "/var/www/html/dokuwiki/upload">
Order allow,deny
Allow from 192.168.1

于 2013-03-01T10:27:30.523 回答