上传时无法创建临时文件

aer*_*jun 5 php forms iis upload

尝试使用表单和PHP / IIS 7上传文件时,出现以下消息:

PHP Warning:  File upload error - unable to create a temporary file in Unknown on line 0
Run Code Online (Sandbox Code Playgroud)

我的表格:

<form action="acciones.php" id="form3" method="POST" enctype="multipart/form-data">
    <input type="hidden" value="3" name="accion">
    <input type="text" name="nombre" placeholder="Nombre">
        <input type="file" name="imagen" accept="image/x-png, image/gif, image/jpeg" />
    <input type="button" id="envio" class="button azul" value="Agregar" onclick="envios()">
</form>
Run Code Online (Sandbox Code Playgroud)

我的PHP代码和参考:

$target = "/images/";
$target = $target . basename( $_FILES['imagen']['name']);
//This gets all the other information from the form
$name=$_POST['nombre'];
$pic=($_FILES['imagen']['name']);

//Writes the information to the database
$query = "INSERT INTO Playeras (Nombre, Ruta) VALUES ('$name', $pic')";
mysql_query($query, $conexion -> conn) or die("Error: ".mysql_error()) ;

//Writes the photo to the server
if(move_uploaded_file($_FILES['imagen']['tmp_name'], $target))
{
    //Tells you if its all ok
    echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded, and your information has been added to the directory";
}
else 
{
 //Gives and error if its not
 echo "Sorry, there was a problem uploading your file.";
}
Run Code Online (Sandbox Code Playgroud)

我已经设置了临时文件的路径:

upload_tmp_dir = "C:/Users/server/Pictures/tmp"
Run Code Online (Sandbox Code Playgroud)

并授予IIS_IUSRS和IUSRS完全控制权。但是每次,我都会得到错误。我不知道我在做什么错。如果有人可以帮助我,那就太好了。

aer*_*jun 6

使它工作。

已变更

upload_tmp_dir = "C:/Users/server/Pictures/tmp" to "C:\TEMP".
Run Code Online (Sandbox Code Playgroud)

在C中创建文件夹TEMP并授予权限。似乎仅在直接连接到C:时才起作用。