如何让file类型的input元素自动选取一个文件?

LonelyWolfx 2003-09-24 05:36:47
我想用javascript控制所要选取的文件,请问如何解决??
...全文
752 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
xiaobaowu 2003-10-16
  • 打赏
  • 举报
回复
mark
sshwsfc 2003-09-24
  • 打赏
  • 举报
回复
to hrong(黄蓉)

这也能让你想到!!
luoluonet 2003-09-24
  • 打赏
  • 举报
回复
不太明白楼主的意思~~

控制文件~ I/O吗?

hrong 2003-09-24
  • 打赏
  • 举报
回复
<script language=javascript>
function window.onload()
{
meizz.focus();
var WshShell=new ActiveXObject("WScript.Shell"); //会有安全提示
WshShell.sendKeys("c:\\test.txt"); //向文本框里发送东东
}
</script>
<input name=meizz type=file>
sshwsfc 2003-09-24
  • 打赏
  • 举报
回复
楼上的方法测试通过了么?
gen2 2003-09-24
  • 打赏
  • 举报
回复
fileControlID.Value=文件名称


Dim path As String
Dim i As Integer
Dim name As String
Dim temp As String
If Not File1.PostedFile Is Nothing Then
path = File1.PostedFile.FileName
i = path.LastIndexOf(".")
name = path.Substring(i)

If name = ".gif" Or name = ".jpg" Or name = "GIF" Or name = "JPG" Then
' If File1.Value <> "" Then
Try
temp = CStr(DateTime.Now.Hour) + CStr(DateTime.Now.Minute) + CStr(DateTime.Now.Second)
File1.PostedFile.SaveAs(Server.MapPath("/bwjcare/photo/" + temp + name))
save(temp, name)
Image1.ImageUrl = "/bwjcare/photo/" + temp + name
Label5.Visible = True
Label6.Visible = True
type.Text = File1.PostedFile.ContentType
size.Text = CStr(Math.Round(File1.PostedFile.ContentLength / 1024)) + "K"
Catch
Response.Write(Image1.ImageUrl)
Response.Write(File1.PostedFile.ContentType)
Response.Write(File1.PostedFile.ContentLength)
End Try


end if
inanition 2003-09-24
  • 打赏
  • 举报
回复
首先是不允许,所以不行。
xishanlang2001 2003-09-24
  • 打赏
  • 举报
回复
不行的.这样会有安全问题.
你去查一下老的相关的帖子,呵呵.

87,988

社区成员

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

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