mmcrorey
asked on
Transfer a file from server A to server B
Here is what I am trying to do...i have a client that wants wants to be able to use their browser to see a list of files that is on their web server. After the client clicks on the specific file they want it to be submitted by form to a specific site. I have already built out the drop down box with the dynamic list of files in the folder, but I have come to a stand still on being able to submit from the server.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
HI,
I Think What mmcrorey need is a way to transfer file between server like we usually do through ftp.
So have 2 choices: create ActiveX/Ole control by yourself that can perform ftp function or get it freely.
Go to www.niblack.com for aspFTP component. that's all you need.
Take a look at my code, so you know that aspFTP is really your need:
<%@ LANGUAGE=VBScript %>
<!--#Include File="aspftp2.inc"-->
<%
'check to see if user submitted form
If Request.Form("PutIt") <> "" Then
Dim objFTP
Dim strMsg
'create reference to object
Set objFTP = Server.CreateObject("NIBLA CK.ASPFTP" )
'set the properties for the connection NOte: this is not a really setting
objFTP.sServerName = "YourServerNameThatWillBeT ransferred aFile"
objFTP.sUserID = "anonymous"
objFTP.sPassword = "user@company.com"
'connect to the host
If objFTP.bConnect Then
'set the properties for the put function
objFTP.lTransferType = TRANSFER_TYPE_ASCII
'now transfer the file
If objFTP.bPutFile("c:\myfilet.txt", "myfile.txt") Then
'transfer was successful
strMsg = "Transfer Successful!"
Else
'Transfer failed...let user know
strMsg = "Put Failed: " & objFTP.sError
End If
Else
'connection failed...let user know
strMsg = "Connection Failed: " & objFTP.sError
End If
'clean up...
Set objFTP = Nothing
Else
'default return msg
strMsg = ""
End If
%>
<html>
<body>
This example uses the Put method (bPutFile). All parameters
required for receiving a file are explicitly defined in the ASP code.<br>
<hr>
<br>
<%If strMsg <> "" Then%>
Return Message: <%=strMsg%><br>
<hr>
<br>
<%End If%>
<form action="AspFTP2_Put.asp" method="post">
<input type="submit" name="PutIt" value="Put File">
</form>
Easy, Isn't it??And you can deploy that into your actual project OK
hope this helps
Cah
I Think What mmcrorey need is a way to transfer file between server like we usually do through ftp.
So have 2 choices: create ActiveX/Ole control by yourself that can perform ftp function or get it freely.
Go to www.niblack.com for aspFTP component. that's all you need.
Take a look at my code, so you know that aspFTP is really your need:
<%@ LANGUAGE=VBScript %>
<!--#Include File="aspftp2.inc"-->
<%
'check to see if user submitted form
If Request.Form("PutIt") <> "" Then
Dim objFTP
Dim strMsg
'create reference to object
Set objFTP = Server.CreateObject("NIBLA
'set the properties for the connection NOte: this is not a really setting
objFTP.sServerName = "YourServerNameThatWillBeT
objFTP.sUserID = "anonymous"
objFTP.sPassword = "user@company.com"
'connect to the host
If objFTP.bConnect Then
'set the properties for the put function
objFTP.lTransferType = TRANSFER_TYPE_ASCII
'now transfer the file
If objFTP.bPutFile("c:\myfilet.txt", "myfile.txt") Then
'transfer was successful
strMsg = "Transfer Successful!"
Else
'Transfer failed...let user know
strMsg = "Put Failed: " & objFTP.sError
End If
Else
'connection failed...let user know
strMsg = "Connection Failed: " & objFTP.sError
End If
'clean up...
Set objFTP = Nothing
Else
'default return msg
strMsg = ""
End If
%>
<html>
<body>
This example uses the Put method (bPutFile). All parameters
required for receiving a file are explicitly defined in the ASP code.<br>
<hr>
<br>
<%If strMsg <> "" Then%>
Return Message: <%=strMsg%><br>
<hr>
<br>
<%End If%>
<form action="AspFTP2_Put.asp" method="post">
<input type="submit" name="PutIt" value="Put File">
</form>
Easy, Isn't it??And you can deploy that into your actual project OK
hope this helps
Cah
ASKER
Can this work the same way by posting the information from one server to a specific url?
Specific URL? You mean specific directory in another server? You should read the documentation in aspFTP component OK, Have got it??
Good LUck
Cah
Good LUck
Cah
This question was awarded, but never cleared due to the JSP-500 errors of that time. It was "stuck" against userID -1 versus the intended expert whom you awarded. This corrects the problem and the expert will now receive these points; points verified.
Please click on your Member Profile and select "View Question History" to navigate through any open or locked questions you may have to update and finalize them. If you are an EE Pro user, you can also choose Power Search to find all your open questions.
This is the Community Support link, if help is needed. Also a question is posted there specific to these changes that apply to the experts here. Also, I am including the link to our All Topics, since many new ones have recently been added.
https://www.experts-exchange.com/jsp/qList.jsp?ta=commspt
https://www.experts-exchange.com/jsp/zonesAll.jsp
Thank you,
Moondancer
Moderator @ Experts Exchange
Please click on your Member Profile and select "View Question History" to navigate through any open or locked questions you may have to update and finalize them. If you are an EE Pro user, you can also choose Power Search to find all your open questions.
This is the Community Support link, if help is needed. Also a question is posted there specific to these changes that apply to the experts here. Also, I am including the link to our All Topics, since many new ones have recently been added.
https://www.experts-exchange.com/jsp/qList.jsp?ta=commspt
https://www.experts-exchange.com/jsp/zonesAll.jsp
Thank you,
Moondancer
Moderator @ Experts Exchange
if the paths are wrong in the combobox then use a select case statement eg:
SELECT CASE request.form("ComboBoxName
case "File1"
response.redirect("myUrl1.
case "File2"
response.redirect("myUrl2.
etc.....
END SELECT