Код: Выделить всё
$url = "http://bla-bla.com/index.php?action=gallery&sa=add2";
# создадим нового Агента пользователя
use LWP::UserAgent;
$ua = LWP::UserAgent->new;
my $req = HTTP::Request->new(POST=>$url);
# указываем тип контекста
$req->content_type('application/x-www-form-urlencoded');
# вводим сам контекст для передачи
$req->content("title=hjgj;cat=1;file=test.jpg");
my $res = $ua->request($req);
# получаем ответ от выводим его
print "Content-type: text/html\n\n";
print $res->content;
как написать в код, что я хочу первую категорию (или любую), не могу вдуплить как??
Код: Выделить всё
cat=1
в движке не могу понять как тут делаеться...
Код: Выделить всё
cat=[1]
Код: Выделить всё
<td align="right"><b>Category:</b> </td>
<td><select name="cat"><option value="1" selected="selected">image</option><option value="2" >mig</option><option value="3" >Фотки</option></select>
Код: Выделить всё
function AddPicture2()
{
global $ID_MEMBER, $txt, $db_prefix, $scripturl,$modSettings, $boarddir,$sourcedir,$gd2;
isAllowedTo('smfgallery_add');
if(empty($modSettings['gallery_path']))
{
$modSettings['gallery_path'] = $boarddir . '/gallery/';
}
//Check if gallery path is writable
if (!is_writable($modSettings['gallery_path']))
fatal_error($txt['gallery_write_error'] . $modSettings['gallery_path']);
$title = htmlspecialchars($_REQUEST['title'],ENT_QUOTES);
$description = htmlspecialchars($_REQUEST['description'],ENT_QUOTES);
$keywords = htmlspecialchars($_REQUEST['keywords'],ENT_QUOTES);
$cat = (int) $_REQUEST['cat'];
@$allowcomments = $_REQUEST['allowcomments'];
//Check if pictures are auto approved
$approved = (allowedTo('smfgallery_autoapprove') ? 1 : 0);
//Allow comments on picture if no setting set.
if(empty($modSettings['gallery_commentchoice']) || $modSettings['gallery_commentchoice'] == 0)
$allowcomments = 1;
else
{
if(empty($allowcomments))
$allowcomments = 0;
else
$allowcomments = 1;
}
как это понимать?
Код: Выделить всё
$cat = (int) $_REQUEST['cat'];
на выходе
Код: Выделить всё
<table border="0" width="80%" cellspacing="0" align="center" cellpadding="4" class="tborder">
<tr class="titlebg">
<td>An Error Has Occurred!</td>
</tr>
<tr class="windowbg">
<td style="padding: 3ex;">
You need to select a category.
</td>
</tr>
</table>
скажите, пожалуйста как указать ту категорию с html тэгов? и загрузить файл...
я хочу загрузить файлы с каталога (масива) в CMS фотогалерею.... (много)