$x="D:/My Documents/My Pictures/http_imgloadfty.jpg";
$filename=$_FILES[$x]['name'];
echo $filename;应该怎么解决呢,请教。

解决方案 »

  1.   

    $_FILES只在上传文件的时候才生效。$x="D:/My Documents/My Pictures/http_imgloadfty.jpg";
    var_export(basename($x));
      

  2.   


    <!-- The data encoding type, enctype, MUST be specified as below -->
    <form enctype="multipart/form-data" action="__URL__" method="POST">
        <!-- MAX_FILE_SIZE must precede the file input field -->
        <input type="hidden" name="MAX_FILE_SIZE" value="30000" />
        <!-- Name of input element determines name in $_FILES array -->
        Send this file: <input name="userfile" type="file" />
        <input type="submit" value="Send File" />
    </form>$_FILES['userfile']['name']
    The original name of the file on the client machine. $_FILES['userfile']['type']
    The mime type of the file, if the browser provided this information. An example would be "image/gif". This mime type is however not checked on the PHP side and therefore don't take its value for granted. $_FILES['userfile']['size']
    The size, in bytes, of the uploaded file. $_FILES['userfile']['tmp_name']
    The temporary filename of the file in which the uploaded file was stored on the server. $_FILES['userfile']['error']
      

  3.   

    enctype="multipart/form-data" 别漏这个.