Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Upload File from IIS server to a remote FTP Location

Posted on 2004-04-07
4
Medium Priority
?
2,303 Views
Last Modified: 2007-12-19
Hello All,
I am trying to upload  files from an IIS server (text file) to a remote FTP site through ASP and I am running into all kinds of problems.  I tried using the ASPInet control and I always get error messages like 12007 and 12111.  I tried all permutations for that and gave up hope.  Next tried the MS Internet transfer control and I am not having much luck with it.  It just seems to hang in trying to instantialte that object.

ANybody have any other options or what am I doing wrong?  I have no problems accessing the remote server FTP location from my location through the web browser.


Attached are the codes for both ASP Inet control and MS Internet control

******************************************************************************************
ASP Inet Code
*****************************************************************************************

FTP_TRANSFER_TYPE_ASCII = 1
 FTP_TRANSFER_TYPE_BINARY = 2


  Set FtpConn = Server.CreateObject("AspInet.FTP")
 
  if FtpConn.FTPPutFile("LOCALHOST", "Anonymous", "", "test2.csv", "c:\test2.csv", FTP_TRANSFER_TYPE_BINARY) then
    Response.Write "<p>FTP upload Success...<br>"
  else
   Response.Write "<p>FTP upload Failed...<br>"
   Response.Write FtpConn.LastError
  end if
******************************************************************************************
MS Internet Control COde
******************************************************************************************
FTP_TRANSFER_TYPE_ASCII = 1
  FTP_TRANSFER_TYPE_BINARY = 2



  'Set FtpConn = Server.CreateObject("AspInet.FTP")
  Set HttpObj = Server.CreateObject("InetCtls.Inet.1")
 
  HttpObj.Protocol = FTP
  HttpObj.AccessType= 0
      'HttpObj_StateChanged(State)
 
if HttpObj.StillExecuting then
Response.Write "still"
else
Response.Write "end"
end if
Response.end
HttpObj.url="ftp://ftp.remoteserver.com"

HttpObj.UserName="Username"
HttpObj.Password="PW"
'HttpObj.Execute ,"DIR"

'HttpObj.Execute ,"put C:\test2.csv /test2.csv"
HttpObj.Execute ,"CLOSE"



  Response.Write "Error is " & HttpObj.ResponseInfo & Httpobj.ResponseCode
 
0
Comment
Question by:geoenvi
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 

Expert Comment

by:tiritas
ID: 10778757
Hi geoenvi,

The 12007 error corresponds to ERROR_INTERNET_NAME_NOT_RESOLVED, which means that the host name you specified was not resolved.  Are you sure you used the correct host name?  Try connecting to the same server manually with an FTP client.  Did you get this error while connecting to "localhost"?  This would be very strange.

The 12111 error means ERROR_FTP_DROPPED, which means that the FTP operation was not completed because the session was aborted.  I've seen this in some situations with firewall-related issues.  In some cases it was solved by switching from ACTIVE FTP to PASSIVE FTP.

Regards,
Tiritas
0
 

Author Comment

by:geoenvi
ID: 10779340
Yes to the first Question.  When connecting to localhost, I get the other error 12111.  How would you switch from active FTP to passive FTP for the iNET component?  I switched my browser to do that and I am manually able to connect to the FTP site but the idea is to progamaticcaly connect
0
 
LVL 5

Accepted Solution

by:
Netminder earned 0 total points
ID: 10820457
Closed, 500 points refunded.
Netminder
Site Admin
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question