HTML - Input section of Boby upload files

 

 Essays and records to facilitate their access to fellow travelers.

#------------------------------------------------I ------------------------------------------- dividing line is a shame

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>input系列</title>
</head>
<body>
    <form>
        <p>上传文件:</p>
        上传<input  type="file" />
    </form>
</body>
</html>

The results show:

Click Choose File Open dialog box, select the file, but the above HTML code that may not work because there is no name background is not receiving data, change the code after:

 

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>input系列</title>
</head>
<body>
    <form>
        <p>上传文件:</p>
        上传<input  type="file" name="filename"/>
        <input type="submit" value="提交"/>
    </form>
</body>
</html>

 

The results show:

 

This looks like it, do not worry lad, this is still not drop, because the submission relies form the form of an attribute enctype = "multipart / form-the Data" , now is not, I did not add to it :

 

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>input系列</title>
</head>
<body>
    <form enctype="multipart/form-data">
        <p>上传文件:</p>
        上传<input  type="file" name="filename"/>
        <input type="submit" value="提交"/>
    </form>
</body>
</html>

The results show:

 

Guess you like

Origin www.cnblogs.com/lirongyang/p/11250558.html