我想我可以创建一个$ _session ['image_name'],然后在随后的“成功上传”页面上调用该会话。我似乎无法弄清楚它的正确性。我需要这个名字,以便我可以将它存储在mysql数据库中。下面是不重命名和我在创建会话的尝试我上传的代码部分:
/
/ make a unique filename for the uploaded file and check it is
// not taken... if it is keep trying until we find a vacant one
$now = time();
while(file_exists($uploadFilename = $uploadsDirectory.$now.'-'.$_FILES[$fieldname]['name']))
{
$now++;
$_SESSION['image_name'] = $uploadsDirectory.$now.'-'.$_FILES[$fieldname]['name'];
}
在我successfulUpload PHP页面,我回:
Congratulations! Your file echo $_Session['image_name']; ?> upload was successful
我有session_start();位于uploadProcessing代码和Successful uploads页面的最顶端。
感谢您的帮助!
+0
你有session_start()吗? –
2011-03-19 18:53:41
+0
是,两个文件上都有session_start()。 –
2011-03-19 19:08:48