• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 901
  • Last Modified:

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.
1 Solution
make sure that the first (default) option in the combo box is blank and put this serverside script near the top of your code:

if trim(request.form("ComboBoxName") <> "" then
end if

and make sure that the combobox is within the <FORM> tags.

and when you submit the page with a value in the combobox you will be redirected to that page.

if the paths are wrong in the combobox then use a select case statement eg:

SELECT CASE request.form("ComboBoxName")
  case "File1"
  case "File2"

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("NIBLACK.ASPFTP")

      'set the properties for the connection NOte: this is not a really setting
      objFTP.sServerName = "YourServerNameThatWillBeTransferredaFile"
      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!"
                'Transfer failed...let user know
                strMsg = "Put Failed: " & objFTP.sError
            End If
            'connection failed...let user know
            strMsg = "Connection Failed: " & objFTP.sError      
      End If
      'clean up...
      Set objFTP = Nothing
      'default return msg
      strMsg = ""
End If


This example uses the Put method (bPutFile). All parameters
required for receiving a file are explicitly defined in the ASP code.<br>

<%If strMsg <> "" Then%>
Return Message: <%=strMsg%><br>
<%End If%>

<form action="AspFTP2_Put.asp" method="post">
<input type="submit" name="PutIt" value="Put File">

Easy, Isn't it??And you can deploy that into your actual project OK

hope this helps
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

mmcroreyAuthor Commented:
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

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.

Thank you,
Moderator @ Experts Exchange
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now