简体   繁体   English

PHP,WAMP-无法打开流:HTTP包装器

[英]PHP, WAMP - failed to open stream: HTTP wrapper

I'm testing a project with WAMP, but I had a problem when I upload a file and copy, it returns: 我正在使用WAMP测试项目,但是在上传文件并复制时遇到问题,它返回:

failed to open stream: HTTP wrapper does not support writeable connections in C:\\wamp\\www\\ 无法打开流:HTTP包装器不支持C:\\ wamp \\ www \\中的可写连接

What can I do? 我能做什么?

Here's my code: 这是我的代码:

<?php 
session_start();
if ( isset($_SESSION['user']) ) {
    $nombre=$_SESSION['user'];
    $nombrefoto=$_FILES['foto']['name'];
    $ruta=$_FILES['foto']['tmp_name'];
    $destino = "http://localhost/usuarios/".$_SESSION['user'].".jpg";
    copy($ruta,$destino);
} else {

}

?>

You need to have a writable filesystem set as your copy destination ... this is probably what you mean. 您需要将可写文件系统设置为复制目标……这可能就是您的意思。

$destino = $_SERVER["DOCUMENT_ROOT"]."/usuarios/".$_SESSION['user'].".jpg";
copy($ruta,$destino);

Make sure that the usuarios directory in your document root exists and is writable by the web server. 确保文档根目录中的usuarios目录存在并且可由Web服务器写入。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM