简体   繁体   中英

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:

failed to open stream: HTTP wrapper does not support writeable connections in 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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