找到你要的答案

Q:Grabbing file information with input tag [duplicate]

Q:用输入标签抓取文件信息[副本]


I want to use these codes to get user selected file directory... or another information like size of the files and etc... and then echo it... can you help? I use php.
tnx

<form method="post">
    <input name="a" type="file">
    <input type="submit" value="Choose!">
</form>


I want to use these codes to get user selected file directory... or another information like size of the files and etc... and then echo it... can you help? I use php.
tnx

<form method="post">
    <input name="a" type="file">
    <input type="submit" value="Choose!">
</form>
answer1: 回答1:

Assuming (because you have provided minimum information) you are using PHP and actually uploading the files, you can look at the following resources

http://www.w3schools.com/php/php_file_upload.asp

http://www.w3schools.com/php/func_filesystem_filesize.asp

Additional resources:

Javascript to check filesize before upload in Internet Explorer

假设(因为你提供最低限度的信息)你是用PHP,其实上传的文件,你可以看看下面的资源

http://www.w3schools.com/php/php_file_upload.asp

http://www.w3schools.com/php/func_filesystem_filesize.asp

额外的资源:

JavaScript在Internet Explorer中查看文件上传

answer2: 回答2:

I found my answer in this form:

<html>
<form method="post" enctype="multipart/form-data">
    <input name="a" id="a" type="file"><br/><br/>
    <input type="submit" value="Choose your file!">
</form>
</html>
<?php
error_reporting(E_ERROR);
echo 'Size (bit unit) : '.$_FILES["a"]["size"].'<br/>';
echo 'Type : '.$_FILES["a"]["type"];
?>

I can't access to file directory of user... cause this is a form of attacking.

我在这个表格里找到了我的答案:

<html>
<form method="post" enctype="multipart/form-data">
    <input name="a" id="a" type="file"><br/><br/>
    <input type="submit" value="Choose your file!">
</form>
</html>
<?php
error_reporting(E_ERROR);
echo 'Size (bit unit) : '.$_FILES["a"]["size"].'<br/>';
echo 'Type : '.$_FILES["a"]["type"];
?>

我无法访问用户的文件目录…因为这是一种攻击形式。

javascript  jquery  html  file  input