Visualizzazione dei risultati da 1 a 4 su 4
  1. #1

    [opendir] aprire una directory remota.

    ho letto dal manuale testuali parole:

    opendir(path);
    path can also be any URL which supports directory listing.

    Ecco non ho idea di cosa sia questo supporto al "directory listing" ne dove vedere se c'è...
    fatto sta che ho provato a usare opendir su un'url e mi da questo errore:

    Warning: opendir(http://10.0.0.7/UserFiles) [function.opendir]: failed to open dir: not implemented in c:\programmi\programmazione\Apache\htdocs\funzioni \gestioneIndirizzi.php on line 541

    forse questo famoso "directory listing" nn è attivo sul server che sto usando?? come lo verifico?

    (sto usando apache 1.3.27 PHP 5.0.5)

  2. #2
    Utente di HTML.it
    Registrato dal
    Aug 2006
    Messaggi
    833
    Se vuoi visualizzare delle cartelle, sottocartelle con i file contenuti dentro,
    Io ho usato un file php (dirlist.php) che ho messo dentro la cartella madre e chiamandolo da una finestra (http://indirizzo/dirlist.php) vedo tutti i contenuti della cartella.
    Non so se e' questo che ti serve, comunque posto il dirlist.php, ciao:

    dirlist.php





    <?

    // Processing variables by "GET" input

    $inpath = $_GET['dir'];
    $sub = $_GET['sub'];

    if (!IsSet($inpath) || ($inpath == ""))
    {
    $inpath = "";
    $directory = ".";
    }
    else $directory = explode("|",$inpath);

    if (!IsSet($sub) || ($sub < 0))
    {
    $sub = 0;
    $directory = ".";
    }

    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <title>Gestione richieste di assistenza</title>

    <style type="text/css">



    .navigate
    {
    font-family : Arial black, Geneva, Arial, Helvetica, sans-serif;
    font-weight : normal;
    font-size : 12px;
    color: blue;
    }
    .title
    {
    font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
    font-weight : bold;
    font-size : 14px;
    color: black;
    }
    .dir
    {
    font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
    font-weight : bold;
    font-size : 18px;
    color: navy;

    }
    .file
    {
    font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
    font-weight : normal;
    font-size : 12px;
    color: blue;
    }
    .copy
    {
    font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
    font-weight : normal;
    font-size : 10px;
    color: black;
    }

    </style>
    <body>

    <body style="overflow:hidden;" bgcolor="#F7F7F7" leftmargin="0" rightmargin="0" topmargin="0">


    <div class="title">Scelta PTF:</div>




    <font face="Arial Black">
    Home
    </font>









    <?

    // Processing directories

    $path = "";
    for ($i=0; $i<=$sub; $i++)
    {
    $folder = chdir($directory[$i]);
    $path = $path . $directory[$i] . "|";
    if (($directory[$i] != "") and ($directory[$i] != "."))
    echo " - <a class=\"navigate\" href=\"dirlist.php?dir=". $path . "
    &sub=".($i+1)."\">" . $directory[$i] . "</a>";
    }

    echo "\n<hr>\n";

    // Getting directory's info...

    $folder = opendir(".");

    while ($file = ReadDir($folder))
    {
    $file_array[] = $file;
    }

    // Processing Files&Directories list element by element

    foreach ($file_array as $file) {

    if (($file == ".") || ($file == "..") ) continue;

    // Checking if it is a directory or a file

    if (FileType($file) == dir)
    {
    if ($inpath != "")
    {
    $path = $inpath . $file . "|";
    $subw = $sub + 1;
    }
    else
    {
    $path = $file ."|";
    $subw = 1;
    }

    $listpath[] = "<a class=\"dir\" href=\"dirlist.php?dir=".$path."&sub=".$subw."\">" .$file."</a>
    \n";
    }
    else
    {
    if ($inpath != "")
    $path = str_replace("|","/",$inpath) . $file;
    else
    $path = $file;

    $listfiles[] = "<a class=\"file\" href=\"".$path."\" target=\"_new\">".$file."</a>
    \n";
    }

    }
    // Printing the list

    for ($id=0; $id<count($listpath); $id++) echo $listpath[$id];
    for ($id=0; $id<count($listfiles); $id++) echo $listfiles[$id];

    // Unsetting all variables
    unset($file_array);
    unset($file);
    unset($folder);
    unset($directory);
    unset($sub);
    unset($subw);
    unset($path);
    unset($id);
    unset($listpath);
    unset($listfiles);
    ?>
    <hr>
    </body>
    </html>

  3. #3
    Non è proprio quello che devo fare... io devo poter accedere a tali file in remoto per poterli copiare pero nn so come fare.

  4. #4
    Se i file sono su un server dovresti usare le funzioni ftp oppure Curl.
    Sistemi di allarme, telecamere, autoradio, video proiettori e altri prodotti tecnologici: fedom.it

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.