【发布时间】:2013-12-04 03:04:39
【问题描述】:
有没有一种方法可以使用 $_FILES 在其他页面上传递价值?
这是我的代码:
test.php:
<form id="form" method="post" enctype="multipart/form-data">
<input type="file" name="userfile" id="userfile">
<input type="submit" id="submit" name="submit" value="Submit">
</form>
提交.php:
<?php
if (isset( $_SERVER['HTTP_X_REQUESTED_WITH'] )):
if (!empty($_POST['name']) AND !empty($_POST['email']) AND !empty($_POST['comment'])) {
$name = $_POST['name'];
$mail = $_POST['email'];
$message = $_POST['comment'];
$ticket_id = $_POST['id'];
$file = $_FILES['userfiles'];
$comment->insertMessage($ticket_id,$message,$name);
}
if(!empty($_FILES['userfile'])) {
$comment->attachFile();
}
?>
<?php
endif
?>
如何使用 $_FILES 传递值?
【问题讨论】:
-
我完全不知道你想问什么。
-
你想问什么?'
-
我如何将值从这里 传递到 submit.php 页面
-
你把你想要表单提交到的页面的URL放在action属性中,然后你点击提交按钮。
-
@user2434677 move_uploaded_file ($_FILES['userfile']['tmp_name'] , $destination)