Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Code Support: ASP (Non-Forum Related)
 FTP using ASP
 New Topic  Topic Locked
 Printer Friendly
Next Page
Author Previous Topic Topic Next Topic
Page: of 3

kolucoms6
Average Member

845 Posts

Posted - 21 May 2007 :  17:53:48  Show Profile

I am looking forward to upload file directly from my asp page to some directory on FTP server or secured server ( I will have login details)

Any Help or any sample code available ?

kolucoms6
Average Member

845 Posts

Posted - 21 May 2007 :  18:06:47  Show Profile
Here is One code I got from : http://dypso.free.fr/tech/asp-ftp-recuperer-fichier-sans-composant-en.php

But doesnt seems to be working. ..

quote:


Microsoft VBScript runtime error '800a0046'
Permission denied

/ftp.asp, line 60


at

quote:
Call oScript.Run ("cmd.exe /c " & strCMD & " > " & strTempFile, 0, True)


<%

Dim objFSO, objTextFile, oScript, oScriptNet
Dim oFileSys, oFile, strCMD, strTempFile, strCommandResult
Dim ftp_address, ftp_username, ftp_password
Dim ftp_physical_path, ftp_files_to_put

' Put your values
ftp_address = "ftp.server.com"
ftp_username = "guest"
ftp_password = "guest"

' let it empty if the file is in the ftp root
ftp_remote_directory = "subdirectory"



ftp_files_to_put = "file.txt"

On Error Resume Next
Set oScript = Server.CreateObject("WSCRIPT.SHELL")
Set oFileSys = Server.CreateObject("Scripting.FileSystemObject")
Set objFSO = CreateObject("Scripting.FileSystemObject")

' Write the ftp commands
Set objTextFile=objFSO.CreateTextFile(Server.MapPath("test.ftp"))
objTextFile.WriteLine "lcd " & Server.MapPath(".")
objTextFile.WriteLine "open " & ftp_address
objTextFile.WriteLine ftp_username
objTextFile.WriteLine ftp_password

' Verify if we have to do a cd
If ftp_remote_directory <> "" Then
objTextFile.WriteLine "cd " & ftp_remote_directory
End If

objTextFile.WriteLine "prompt"

' Write this line if the file is a binary one(image,...)
' objTextFile.WriteLine "binary"


'With multiple files use mput
' instead of put
If Instr(1, ftp_files_to_put, "*",1) Then
objTextFile.WriteLine "mput " & ftp_files_to_put
Else
objTextFile.WriteLine "put " & ftp_files_to_put
End If
objTextFile.WriteLine "bye"
objTextFile.Close
Set objTextFile = Nothing


' Launch ftp.exe on
' the command line
strCMD = "ftp.exe -s:" & Server.MapPath("test.ftp")
strTempFile = "C:\" & oFileSys.GetTempName( )

Call oScript.Run ("cmd.exe /c " & strCMD & " > " & strTempFile, 0, True)
Set oFile = oFileSys.OpenTextFile (strTempFile, 1, False, 0)

On Error Resume Next

' We save the result of the command
' in a temporary file

strCommandResult = Server.HTMLEncode( oFile.ReadAll )
oFile.Close

' We delete the temporary file and the commands
Call oFileSys.DeleteFile( strTempFile, True )
Call objFSO.DeleteFile( Server.MapPath("test.ftp"), True )
Set oFileSys = Nothing
Set objFSO = Nothing

' We write out the result of the ftp commands
Response.Write(Replace( strCommandResult, vbCrLf, "", 1, -1, 1))

%>

Edited by - kolucoms6 on 21 May 2007 18:11:29
Go to Top of Page

HuwR
Forum Admin

United Kingdom
20595 Posts

Posted - 21 May 2007 :  18:32:52  Show Profile  Visit HuwR's Homepage
quote:
Microsoft VBScript runtime error '800a0046'
Permission denied

/ftp.asp, line 60

Sounds more like a ile/directory pemissions error rather than a poblem with the script
Go to Top of Page

kolucoms6
Average Member

845 Posts

Posted - 21 May 2007 :  18:35:22  Show Profile

Even i guessed it right ..

Its NOT allowing cmd.exe to execute.

Any other way to upload file ?
Go to Top of Page

MaD2ko0l
Senior Member

United Kingdom
1053 Posts

Posted - 21 May 2007 :  18:47:08  Show Profile  Visit MaD2ko0l's Homepage
y do u need to upload files using ftp through an asp page??? is there a specific reason for this or r u just trying new things out???

u can either use a normal ftp program as most peopel do or u can login to your site through the internet browser

just type in your url to your site and instead of www.yoursite.com type ftp.yoursite.com then right click and press login, enter your details and that will aloow u to sent files to your site through ftp.

on the other hand, it u need a asp script to upload a file then maybe u need to look for a www.asp101.com/articles/jacob/scriptupload.asp" target="_blank">PureASP Upload Script like this one found at www.asp101.com/articles/jacob/scriptupload.asp" target="_blank">ASP101

or maybe u can ask your host if they have any upload components installed that u can use to uplaod your files.

hope this helps

MaD2ko0l

© 1999-2010 MaD2ko0l
Go to Top of Page

kolucoms6
Average Member

845 Posts

Posted - 21 May 2007 :  18:52:20  Show Profile

Here it goes :

1) I want to create 3 text files online using ASP.
2) After creation, want to upload them to 3 different servers.Two of them are secured server.
3) Inform User, that uploaded successfully.

Cant use 3rd party componest as my provider wont allow it.
Go to Top of Page

MaD2ko0l
Senior Member

United Kingdom
1053 Posts

Posted - 21 May 2007 :  19:08:24  Show Profile  Visit MaD2ko0l's Homepage
1) so u want to make 3 text file on a webserver? this may help its about the FSO stuff to create text files on servers.

2) ok,so u wanna upload them to 3 different servers...can u not just use a ftp program or the ways i meantioned in my pervious post?

if not i would presume u had ftp acces your self to uplaod files, then u can use something liek the PureASP upload script and then set up a little email script to inform the user...kinda like the subscriptions on this forum. it wouldnt be to hard to set up something like this on each server.


have u asked your host what 3rd party componets they already have installed? because the server i am on has 2 asp uplaod componets already installed.

© 1999-2010 MaD2ko0l
Go to Top of Page

kolucoms6
Average Member

845 Posts

Posted - 21 May 2007 :  19:11:38  Show Profile

1) Resolved and working perfectly.
2) My visitors will create text files online and upload to 3 ftp servers.

I asked my provider and they are NO NO.

But let me ask them if they already have any.
Go to Top of Page

MaD2ko0l
Senior Member

United Kingdom
1053 Posts

Posted - 21 May 2007 :  19:21:45  Show Profile  Visit MaD2ko0l's Homepage
ok...so its your visitors that will be making the files and uploading them... right, i was under the impression that it was just somthing for the admin kinda people.

ok so more than likly, you will need to setup a simple asp upload script liek the 1 i posted above. when the uplaod is completed you usually get a little message saying "uplaod completed sucessfully" or somthign along them lines, that is where u will add the little bit of code that will email someone that the file has been uplaoded.

i hope that made sense.

anyway if u need some scripts/snippets then try http://www.planet-source-code.com , it usually has the stuff i am looking for most the time, i also got the uplaod code from here to make my gallery on my site.

© 1999-2010 MaD2ko0l

Edited by - MaD2ko0l on 21 May 2007 19:22:51
Go to Top of Page

kolucoms6
Average Member

845 Posts

Posted - 21 May 2007 :  19:24:11  Show Profile
This is the thing mainly I am lookign forward :

"you will need to setup a simple asp upload script like "
Go to Top of Page

kolucoms6
Average Member

845 Posts

Posted - 22 May 2007 :  04:24:10  Show Profile

I confirmed with my provider and they have ASPSmart Upload component.

But http://www.aspsmart.com


The aspSmart line of products has been discontinued.

Go to Top of Page

ILLHILL
Junior Member

Netherlands
341 Posts

Posted - 22 May 2007 :  11:56:07  Show Profile
Not sure, but do you want users to upload a txt file then create txt files from whatever they upload?

Cause if so, then it's even easier to have a textarea field, where they can copy and paste, or type whatever they want to type and then generate txt files from that.

Greets, Dominic

CLPPR.com - All The News Only Seconds Away
Go to Top of Page

kolucoms6
Average Member

845 Posts

Posted - 22 May 2007 :  12:22:39  Show Profile

Sorry ILLHILL , but its not that.
Go to Top of Page

ILLHILL
Junior Member

Netherlands
341 Posts

Posted - 22 May 2007 :  12:31:51  Show Profile
Ok...then I assume the upload script and the txt-file writer are two different things :)
The txt file writer is what I have recently been working on, but you have got that to work already.

I was confused cause you said this:

quote:
Originally posted by kolucoms6


2) My visitors will create text files online and upload to 3 ftp servers.



Which would be writing text files through fso as somebody said and would use textarea or other
form objects.

Well, I would like to help you, but am a bit confused at the moment about what you need help with :)

Greets, Dominic

CLPPR.com - All The News Only Seconds Away
Go to Top of Page

MaD2ko0l
Senior Member

United Kingdom
1053 Posts

Posted - 22 May 2007 :  13:06:07  Show Profile  Visit MaD2ko0l's Homepage
http://www.ibiz-solutions.net/resources/help_asp_01_upload.asp this will help you to understand some of the code...from the looks of it it is a simple file uplaod script.

also there is a guy called KC on these forums that uses the ASPSmartUpload on his site over at http://www.vales.com , maybe he will be able to help u out a bit more with the actual code that u need to upload files.

© 1999-2010 MaD2ko0l
Go to Top of Page

kolucoms6
Average Member

845 Posts

Posted - 22 May 2007 :  16:52:55  Show Profile
Thnx Mad2Kool.. Let me find out...
Go to Top of Page
Page: of 3 Previous Topic Topic Next Topic  
Next Page
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.27 seconds. Powered By: Snitz Forums 2000 Version 3.4.07