Development Articles
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsOtherDevelopment Articles

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old January 21st, 2004, 12:22 PM
nallasivan nallasivan is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 13 nallasivan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Article Discussion: FTP段ng Files with ASP

Would you like the ability to transfer files from your ASP app with the greatest of ease? Forget downloading and installing server-side components forget spending money. Forget inefficient and/or cryptic coding! This article demonstrates how easy it is to embed file transfer functionality into your application.


Read the full article here: FTP段ng Files with ASP

Reply With Quote
  #2  
Old February 3rd, 2004, 05:00 AM
paulorelogio paulorelogio is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Posts: 1 paulorelogio User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
ftp files in asp

have anyone used tried this?

where to put the strCommands?

and where do i activate the missing ocx?

if anyone have a real example... please send me some explanation of how to implement.

i always get trouble with this:
set WSX = objShell.Exec( FTP_CMD & strScriptName & " " & Host )

where is the strScriptname declared?, and the ftp_cmd...is it right?

need help
URL

Reply With Quote
  #3  
Old February 7th, 2004, 08:13 AM
digitaldew digitaldew is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Location: Jax Beach, Florida - USA
Posts: 94 digitaldew User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 m 17 sec
Reputation Power: 5
can this be used with an upload form?

Would this be a viable alternative to aspUpload? Would there be security issues if the account had write only permissions and you limited the file extensions allowed for upload?

I'm very interested in replacing aspUpload because it often fails with larger files.

Reply With Quote
  #4  
Old February 18th, 2004, 08:57 AM
frankcow's Avatar
frankcow frankcow is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Location: http://www.justin-cook.com
Posts: 133 frankcow User rank is Private First Class (20 - 50 Reputation Level)frankcow User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 1 h 34 m 16 sec
Reputation Power: 6
sorry, the line should really be:
set WSX = objShell.Exec( COMMAND_FTP & strFile & " " & strHost )

I forgot this one line when trying to make my variables more human readable for the purpose of writing the article. It just so happens that this is the most crucial line :P

The real use of this is transferring files from the SERVER to another SERVER, not from your client machine to the server. Because of this, it would not replace ASPUpload.

ASPUpload would be limited by the natural limits of a POST method (a few megabytes)

Reply With Quote
  #5  
Old April 21st, 2004, 03:13 PM
abro abro is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Location: NJ
Posts: 2 abro User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Would you mind sending me this file???

Reply With Quote
  #6  
Old April 27th, 2004, 10:22 AM
frankcow's Avatar
frankcow frankcow is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Location: http://www.justin-cook.com
Posts: 133 frankcow User rank is Private First Class (20 - 50 Reputation Level)frankcow User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 1 h 34 m 16 sec
Reputation Power: 6
It is attached to this reply
Attached Files
File Type: txt ftp.txt (2.2 KB, 901 views)

Reply With Quote
  #7  
Old May 24th, 2004, 01:26 AM
EAServe EAServe is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 6 EAServe User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thanks!

Reply With Quote
  #8  
Old September 12th, 2004, 03:41 PM
mevasquez mevasquez is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Sep 2004
Posts: 6 mevasquez User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 m 13 sec
Reputation Power: 0
Angry

I am getting a Permission denied error at this line, "Set objFile = objFSO.OpenTextFile(sErrorLog, 2, True )"
sErrorLog is set as "sErrorLog = objTempFldr.Path & "ftpErrors.txt""

Reply With Quote
  #9  
Old September 21st, 2004, 04:49 AM
selwonk's Avatar
selwonk selwonk is offline
Contributing User
ASP Free Loyal (3000 - 3499 posts)
 
Join Date: Jun 2004
Posts: 3,002 selwonk User rank is Second Lieutenant (5000 - 10000 Reputation Level)selwonk User rank is Second Lieutenant (5000 - 10000 Reputation Level)selwonk User rank is Second Lieutenant (5000 - 10000 Reputation Level)selwonk User rank is Second Lieutenant (5000 - 10000 Reputation Level)selwonk User rank is Second Lieutenant (5000 - 10000 Reputation Level)selwonk User rank is Second Lieutenant (5000 - 10000 Reputation Level)selwonk User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 6 Days 19 h 40 m 17 sec
Reputation Power: 105
Quote:
Originally Posted by mevasquez
I am getting a Permission denied error at this line, "Set objFile = objFSO.OpenTextFile(sErrorLog, 2, True )"
sErrorLog is set as "sErrorLog = objTempFldr.Path & "ftpErrors.txt""
This probably indicates a permissions problem. If you have not sorted this out, try posting to the relevant forum for help
__________________
selwonk

If I've posted some code above, you might think it looks a bit simplistic. It might be. I'd rather people tried the next step themselves rather than getting a full solution on a plate. That way they learn more!

Reply With Quote
  #10  
Old September 22nd, 2004, 11:54 AM
mcgeejdw mcgeejdw is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Sep 2004
Posts: 5 mcgeejdw User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
How do you run this example

I have created the ftp.asp file but was wondering how I execute a call to the Function FTP( strCMD ). Any
help would be greatly appreciated.

Reply With Quote
  #11  
Old September 22nd, 2004, 12:39 PM
selwonk's Avatar
selwonk selwonk is offline
Contributing User
ASP Free Loyal (3000 - 3499 posts)
 
Join Date: Jun 2004
Posts: 3,002 selwonk User rank is Second Lieutenant (5000 - 10000 Reputation Level)selwonk User rank is Second Lieutenant (5000 - 10000 Reputation Level)selwonk User rank is Second Lieutenant (5000 - 10000 Reputation Level)selwonk User rank is Second Lieutenant (5000 - 10000 Reputation Level)selwonk User rank is Second Lieutenant (5000 - 10000 Reputation Level)selwonk User rank is Second Lieutenant (5000 - 10000 Reputation Level)selwonk User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 6 Days 19 h 40 m 17 sec
Reputation Power: 105
Post your code...

Reply With Quote
  #12  
Old September 22nd, 2004, 12:54 PM
mcgeejdw mcgeejdw is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Sep 2004
Posts: 5 mcgeejdw User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
My Code

<%@ Language=VBScript %>
<%

Dim strHost, strUser, strPass, strMode, LocalDir, RemoteDir
Dim Output, ReturnCode, strScript
Const COMMAND_FTP = "ftp.exe -i -s:"

strHost = "myftpbox"
strUser = "user"
strPass = "pass"
strMode = "ascii" '=== "ascii" / "binary"
LocalDir = "C:\test"
RemoteDir = "/test/"

'=====================
Function FTP( strCMD )
'=====================
'=== Build a command script, FTPs with it, deletes it
Dim objFSO, strFile, objTempFldr, objFile, objRegExp
Dim objShell, WSX, ReturnCode, Output, strLog, strErrorLog

Set objFSO = CreateObject("Scripting.FileSystemObject")

set objTempFldr = objFSO.GetSpecialFolder( 2 )
strFile = objFSO.GetTempName


strFile = objTempFldr & "" & strFile & ".ftp"
if not objFSO.FileExists( strFile ) then objFSO.CreateTextFile( strFile )
Set objFile = objFSO.OpenTextFile( strFile, 2, True )

objFile.WriteLine( strUser )
objFile.WriteLine( strPass )
If LocalDir <> "" Then objFile.WriteLine( "lcd " & LocalDir )
If RemoteDir <> "" Then objFile.WriteLine( "cd " & RemoteDir )
objFile.WriteLine( Mode )
objFile.WriteLine( strCMD )
objFile.WriteLine( "bye" )
objFile.Close()
Set objShell = Server.CreateObject("WScript.Shell")

set WSX = objShell.Exec( COMMAND_FTP & strFile & " " & strHost )
'set WSX = objShell.Exec( FTP_CMD & strScriptName & " " & Host )
set ReturnCode = WSX.StdErr
set Output = WSX.stdOut
strErrorLog = objTempFldr.Path & "ftpErrors.txt"
strLog = objTempFldr.Path & "ftpLog.txt"

Set objFile = objFSO.OpenTextFile( strErrorLog, 2, True )
objFile.Write( ReturnCode.ReadAll() )
objFile.Close()

Set objFile = objFSO.OpenTextFile( strLog, 2, True )
objFile.Write( Output.ReadAll() )
objFile.Close()
set objFSO = nothing
set objFile = nothing

objFSO.DeleteFile strFile, True
set objFSO = nothing

Set objRegExp = New RegExp
objRegExp.IgnoreCase = True

objRegExp.Pattern = "not connected|invalid command|error"

If (objRegExp.Test( Output.ReadAll ) = True ) Or(objRegExp.Test( ReturnCode.ReadAll ) ) Then 'on one line
FTP = False
Else
FTP = True
End If
Set objRegExp = nothing
End Function



%>


<html>
<head>
<title>
My Test FTP
</title>
</head>

<body>
FTP

<%
Dim strCommands

strCommands = "PUT test.doc"

FTP(strCommands)
%>

</body>


</html>

Reply With Quote
  #13  
Old September 22nd, 2004, 01:04 PM
selwonk's Avatar
selwonk selwonk is offline
Contributing User
ASP Free Loyal (3000 - 3499 posts)
 
Join Date: Jun 2004
Posts: 3,002 selwonk User rank is Second Lieutenant (5000 - 10000 Reputation Level)selwonk User rank is Second Lieutenant (5000 - 10000 Reputation Level)selwonk User rank is Second Lieutenant (5000 - 10000 Reputation Level)selwonk User rank is Second Lieutenant (5000 - 10000 Reputation Level)selwonk User rank is Second Lieutenant (5000 - 10000 Reputation Level)selwonk User rank is Second Lieutenant (5000 - 10000 Reputation Level)selwonk User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 6 Days 19 h 40 m 17 sec
Reputation Power: 105
You already appear to be doing this?
Code:
<%
Dim strCommands 
strCommands = "PUT test.doc"
FTP(strCommands)
%>

Reply With Quote
  #14  
Old September 22nd, 2004, 01:23 PM
mcgeejdw mcgeejdw is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Sep 2004
Posts: 5 mcgeejdw User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Yeah I kind of figured that out before I posted my code to you. Do you know
why I might be getting the following error?

Error Type:
Microsoft VBScript runtime (0x800A01A8)
Object required: 'objFSO'
/ftp.asp, line 59

Reply With Quote
  #15  
Old September 22nd, 2004, 04:25 PM
babaskate babaskate is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Sep 2004
Posts: 1 babaskate User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
no PASV with ftp.exe

Ftp.exe does not support PASV mode transfers through firewalls. Any work around or other ftp implementations?

thanks.


Reply With Quote
Reply

Viewing: ASP Free ForumsOtherDevelopment Articles > Article Discussion: FTP段ng Files with ASP


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules