失眠网,内容丰富有趣,生活中的好帮手!
失眠网 > php 上传没生成文件 php-上传时无法创建临时文件

php 上传没生成文件 php-上传时无法创建临时文件

时间:2021-09-08 04:20:04

相关推荐

php 上传没生成文件 php-上传时无法创建临时文件

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

PHP Warning: File upload error - unable to create a temporary file in Unknown on line 0

我的表格:

$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.";

}

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

upload_tmp_dir = "C:/Users/server/Pictures/tmp"

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

解决方法:

使它工作.

已变更

upload_tmp_dir = "C:/Users/server/Pictures/tmp" to "C:\TEMP".

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

标签:forms,iis,upload,php

来源: https://codeday.me/bug/1030/1971562.html

如果觉得《php 上传没生成文件 php-上传时无法创建临时文件》对你有帮助,请点赞、收藏,并留下你的观点哦!

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。