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/20191030/1971562.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值