使用dokuwiki中的curl命令行上传文件 [英] Upload file using curl command line in dokuwiki
本文介绍了使用dokuwiki中的curl命令行上传文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图找到一种方法来做到这一点。
到目前为止,我已经能够访问页面感谢cookie参数:
I am trying to find a way to do this. So far I have been able to access pages thanks to the cookie parameter:
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页面上获取form参数。我不知道我在找什么:
To upload a file I am supposed to get the form parameter on the php page. I don't exactly know what I am looking for :
curl --form "file=@z.xml" --cookie cookies.txt "http://wiki/doku.php?id=start&tab_files=upload&do=media"
推荐答案
我使它工作不同。
我创建了一个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
这篇关于使用dokuwiki中的curl命令行上传文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文