I often ask me how to send a file directly to the Input File control directly from the CSDN Web.
First technical solution:
When I answered this question, IE also had a vulnerability, so the usual method at the time was to use wscript.shell to assign the File control via SendKeys.
code show as below
Function window.onload ()
{
Document.form1.t1.focus ();
Var wshshell = new activXObject ("wscript.shell");
Wshshell.sendKeys ("c: //test.txt"); // This code is written directly into the text box to write file paths
}
script>
This method is in 2003, it was blocked by Microsoft in the browser, but if you still have friends who play HTA, you can try this black technology.
Second technical solution:
In addition to the above method, some netizens actually have the substance of the File control, but still need to select files after clicking.
In fact, this type of method is relatively simple. Now the plugin transparently contains the container of the container, suspended on the upload button that is seen to the user, so it doesn't need to display the upload control.
div>
Third technical solution:
Using component technology to make IE browser plug-ins, upload data into PUBLIC DECLARE FUNCTION InternetOpen lib "Wininet.dll" Alias "Internetopena" _ (Byval Sagent As String, Byval Sproxyname As String, _ BYVAL SPROXYBYPASS AS STRING, BYVAL LFLAGS AS Long AS Long
Public Declare Function InternetConnect Lib "wininet.dll" Alias "InternetConnectA" _ (ByVal hInternetSession As Long, ByVal sServerName As String, _ ByVal nServerPort As Integer, ByVal sUsername As String, _ ByVal sPassword As String, ByVal lService As Long, _ ByVal Lflags as long, Byval LCONText As long
Public Declare Function FtpGetFile Lib "wininet.dll" Alias "FtpGetFileA" _ (ByVal hFtpSession As Long, ByVal lpszRemoteFile As String, _ ByVal lpszNewFile As String, ByVal fFailIfExists As Boolean, _ ByVal dwFlagsAndAttributes As Long, ByVal dwFlags As Long, _ ByVal dwContext As Long) As BooleanPublic Declare Function FtpPutFile Lib "wininet.dll" Alias "FtpPutFileA" _ (ByVal hFtpSession As Long, ByVal lpszLocalFile As String, _ ByVal lpszRemoteFile As String, ByVal dwFlags As Long, _ ByVal dwContext As Long) As Boolean
Public Declare Function FtpDeleteFile Lib "wininet.dll" Alias "FtpDeleteFileA" _ (ByVal hFtpSession As Long, ByVal lpszFileName As String) As Boolean Public Declare Function FtpRenameFile Lib "wininet.dll" Alias "FtpRenameFileA" _ (ByVal hFtpSession As Long, ByVal lpszExsiting As String, ByVal lpszNew As String) As Boolean Public Declare Function InternetCloseHandle Lib "wininet.dll" (ByVal hInet As Long) As Integer Private Sub Timer1_Timer () lnginet = InternetOpen (vbNullString, INTERNET_OPEN_TYPE_PRECONFIG, _ vbNullString, vbNullString, 0 &) If LNGINET THENTCONN = InternetConnect (LNGINET, "210.51.180.101", 0, _ "User Name", "Password", 1, 0, 0) IF LNGINETCONN THEN BLNRC = ftpputfile (LNGINETCONN, "Your specific uploaded Dongdong" , "FTP site file folder", 0, 0, 1, 0) If blnrc Then MsgBox "download ok !!!" End If InternetCloseHandle lnginetconn InternetCloseHandle lnginet Else a = 1 DoEvents End If Else a = 2 DoEvents End If EndSUB fourth way