需要帮助上传文件到网站 [英] Need a help to upload file to website

查看:82
本文介绍了需要帮助上传文件到网站的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello Team,



我需要将文件上传到网站(我的公司网站根据业务要求)



只是为了一个例子......让我们说... http://www.icoconverter.com

{以这个网站为例,这样我就可以把所有人排除在外}



在网页上我们有TextBox(显示文件路径)和浏览按钮。

当我们点击浏览按钮时,OpenFile显示对话框,用户需要选择文件,然后文本路径显示在TextBox中。



之后我们可以点击转换按钮,文件上传到服务器。



问题/问题:如果没有点击浏览按钮,我可以在文本框中选择路径吗?



我以下工作......



 私有  Sub  CommandButton1_Click()
Dim ie As InternetExplorer
Dim txtBox 作为 变体
Dim path 作为 字符串

ie.Visible = True
ie.Navigate http://www.MyTestWebsite.com

ie.Busy
Application.Wait(Now + TimeSerial( 0 0 2 ))
循环

path = C:\ Users \Public \Pictures \Sample Pictures \ Pengengins.jpg
txtBox = ie.Document.getElementsByName( image

txtBox.Value = path ' 注意到这里发生..我期待Txtbox应该如此路径我们给出

结束 Sub





请帮助....

解决方案

 txtBox.Value = path ' < span class =code-comment>错误 

txtBox.Text = Convert.ToString(path)'


Hello Team,

I need to upload a file to Website(my companies website as per business requirement)

Just for an Example... lets say... http://www.icoconverter.com
{Taking this website as an example so that I quetion will be cler to all}

On Webpage we have TextBox(to show file path) and "Browse" button.
When we click on browse button, OpenFile Dialog box is shown and user need to select the file and then File Path is being shown in TextBox.

And after the we can click on Convert button and File gets uploaded to server.

Problem/Issue: Is it possible that without clicking on 'Browse' button I can take path in Textbox?

I have done below working...

Private Sub CommandButton1_Click()
Dim ie As New InternetExplorer 
Dim txtBox As Variant 
Dim path As String 
 
ie.Visible = True
ie.Navigate "http://www.MyTestWebsite.com"

Do While ie.Busy
Application.Wait (Now + TimeSerial(0, 0, 2))
Loop
 
path = "C:\Users\Public\Pictures\Sample Pictures\Penguins.jpg"
txtBox = ie.Document.getElementsByName("image") 

txtBox.Value = path 'Noting is happend here..I am expecting Txtbox should so Path which we given

End Sub



Please help....

解决方案

txtBox.Value = path 'Wrong

txtBox.Text = Convert.ToString(path) 'Right


这篇关于需要帮助上传文件到网站的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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