在Web浏览器控件中设置文件上传图像路径 [英] Set file upload image path in a web browser control

查看:109
本文介绍了在Web浏览器控件中设置文件上传图像路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,
我正在尝试将选择图像路径设置为浏览器控件内的文件上传控件.
我正在使用此代码:

HtmlElement ImgTxt = webBrowser1.Document.GetElementById("ImageName");

ImgTxt.Focus();

SendKeys.SendWait(imgPath);

Hi All,
I am trying to set the select image path to a file upload control inside a browser control.
I am using this code:

HtmlElement ImgTxt = webBrowser1.Document.GetElementById("ImageName");

ImgTxt.Focus();

SendKeys.SendWait(imgPath);

but nothing is chnaging can anyone help please?

推荐答案

您正在使用SendKeys,这意味着您正在Windows应用程序中使用Web浏览器控件吗? SendKeys智障且功能强大,您永远不要使用或信任它.这是本应与此相伴而生的VB6 hack.

文件上传控件具有特殊的保护功能,可以阻止黑客使用它,您不能在代码中设置它的值,而且很可能也会阻止您在此处尝试执行的操作.
You''re using SendKeys, that means you''re using the web browser control in a windows app ? SendKeys is retarded and hacky, you should never use or trust it. It''s a VB6 hack that should have died with it.

The file upload control has special protection to stop hackers using it, you can''t set it''s value in code, and it could well be blocking what you''re trying to do here, too.


这篇关于在Web浏览器控件中设置文件上传图像路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆