我正在创建自己的上传脚本以将文件上传到我的网络服务器(如小型 Flash 视频)。但是,它似乎不起作用。但是,我认为它不是 PHP,因为通过 Wordpress 将文件上传到我的服务器确实有效。
这是上传表格:
<form enctype="multipart/form-data" action="upload.php" method="POST">
Video: <input name="vid" type="file" />
<br/>
Name: <input name="title" type="text" />
<br/>
Description:
<br/>
<br/>
<textarea name="desc">Your description here</textarea>
<br/>
<br/>
<input type="submit" value="Upload" />
</form>
这是上传PHP页面:
<?php
$target = basename( $_FILES['uploaded']['name']) ;
$ok=1;
//check that $ok was not set to 0 by an error
if ($ok==0)
{
Echo "Sorry your file was not uploaded";
}
//If everything is ok we try to upload it
else
{
if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target))
{
echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded";
}
else
{
echo "Sorry, there was a problem uploading your file.";
}
}
?>
我已将 php.ini 中的最大上传大小设置为 100MB,但是,上传仍然失败。我的 php.ini 文件可以在pastebin 中查看。另请注意,我已从上传脚本中删除所有验证以查看它是否有效。