Ver Mensaje Individual
  #1 (permalink)  
Antiguo 02/10/2008, 21:56
Avatar de Julcar
Julcar
 
Fecha de Ingreso: noviembre-2007
Ubicación: C:\inetpub\wwwroot\Guayaquil
Mensajes: 1.507
Antigüedad: 17 años, 6 meses
Puntos: 54
Ayuda con codigo de ftp

tengo este codigo:

Código asp:
Ver original
  1. <%@ Language=VBScript %>
  2. <%
  3. ' FTP via ASP without using 3rd-party components
  4. ' Ben Meghreblian 15th Jan 2002
  5. ' benmeg at benmeg dot com / [url]http://benmeg.com[/url]
  6. '
  7. ' This script assumes the file to be FTP'ed is in the same directory as this script.
  8. ' It should be obvious how to change this (*hint* change the lcd line)
  9. ' You may specify a wildcard in ftp_files_to_put (e.g. *.txt)
  10. Dim objFSO, objTextFile, oScript, oScriptNet, oFileSys, oFile, strCMD, strTempFile, strCommandResult
  11. Dim ftp_address, ftp_username, ftp_password, ftp_physical_path, ftp_files_to_put
  12.  
  13. ' Edit these variables to match your specifications
  14. ftp_address          = "ftp.server.com"
  15. ftp_username         = "username"
  16. ftp_password         = "password"
  17. ftp_remote_directory = "subdirectory" ' Leave blank if uploading to root directory
  18. ftp_files_to_put     = "file.txt"
  19.  
  20. On Error Resume Next
  21. Set oScript = Server.CreateObject("WSCRIPT.SHELL")
  22. Set oFileSys = Server.CreateObject("Scripting.FileSystemObject")
  23. Set objFSO = CreateObject("Scripting.FileSystemObject")
  24. ' Build our ftp-commands file
  25. Set objTextFile = objFSO.CreateTextFile(Server.MapPath("test.ftp"))
  26. objTextFile.WriteLine "lcd " & Server.MapPath(".")
  27. objTextFile.WriteLine "open " & ftp_address
  28. objTextFile.WriteLine ftp_username
  29. objTextFile.WriteLine ftp_password
  30.  
  31. ' Check to see if we need to issue a 'cd' command
  32. If ftp_remote_directory <> "" Then
  33.    objTextFile.WriteLine "cd " & ftp_remote_directory
  34. End If
  35.  
  36. objTextFile.WriteLine "prompt"
  37.  
  38. ' If the file(s) is/are binary (i.e. .jpg, .mdb, etc..), uncomment the following line' objTextFile.WriteLine "binary"
  39. ' If there are multiple files to put, we need to use the command 'mput', instead of 'put'
  40. If Instr(1, ftp_files_to_put, "*",1) Then
  41.    objTextFile.WriteLine "mput " & ftp_files_to_put
  42. Else
  43.    objTextFile.WriteLine "put " & ftp_files_to_put
  44. End If
  45. objTextFile.WriteLine "bye"
  46. objTextFile.Close
  47. Set objTextFile = Nothing
  48. ' Use cmd.exe to run ftp.exe, parsing our newly created command file
  49. strCMD = "ftp.exe -s:" & Server.MapPath("test.ftp")
  50. strTempFile = "C:\" & oFileSys.GetTempName( )
  51. ' Pipe output from cmd.exe to a temporary file (Not :| Steve)
  52. Call oScript.Run ("cmd.exe /c " & strCMD & " > " & strTempFile, 0, True)
  53. Set oFile = oFileSys.OpenTextFile (strTempFile, 1, False, 0)
  54.  
  55. On Error Resume Next
  56. ' Grab output from temporary file
  57. strCommandResult = Server.HTMLEncode( oFile.ReadAll )
  58. oFile.Close
  59. ' Delete the temporary & ftp-command files
  60. Call oFileSys.DeleteFile( strTempFile, True )
  61. Call objFSO.DeleteFile( Server.MapPath("test.ftp"), True )
  62. Set oFileSys = Nothing
  63. Set objFSO = Nothing
  64. ' Print result of FTP session to screen
  65. Response.Write( Replace( strCommandResult, vbCrLf, "<br>", 1, -1, 1) )
  66. %>

Lo que necesito es eliminar en lo posible todo lo que diga fso, no importa si se modifica el codigo.

¿Alguien me ayuda?
__________________
Linux no es el único S.O. libre, conoce a ReactOS el Windows Libre!
"Si mis respuestas te dan la calma, espárceme un poco de karma"