Author |
Topic |
LOOKUP_BI
Constraint Violating Yak Guru
295 Posts |
Posted - 2008-09-17 : 16:11:30
|
All,Need help for the following. I need to be able to copy a file to Vendor's FTP on weekly basic.I have the following in my Script Task.Upon execution it returns ArgumentException [xxx.com/123/Files/File1.zip'is not a valid remote file address. A valid address should include a protocol, a path and a file name]Here is what I have in my Script TaskDim server As String = "//ftp://xxx.com/123/Files/"Dim User As String = "User1"Dim Password As String = "Password1"Dim remoteFTP As String = server & System.IO.Path.GetFileName(file.FullName)My.Computer.Network.UploadFile(file.FullName, remoteFTP, User, Password, True, 500)While Debugging the remoteFTP string displays= "//ftp://xxx.com/123/Files/File1.zip"I've nvr copied a file to a ftp before.Therfore Im not sure if this code is even correct.Ive got it from http://social.msdn.microsoft.com/forums/en-US/vblanguage/thread/7945dbd9-5836-4eaa-b8fe-32ad70002e43.Appreciate if someone could help me out. Thank You.Im just soo stuck on this piece.  |
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
LOOKUP_BI
Constraint Violating Yak Guru
295 Posts |
Posted - 2008-09-17 : 16:25:30
|
Tara,Tried the suggestin by removing // before ftp.This is what I get The remote server returned an error: (550) File unavailable (e.g., file not found, no access).Now the remoteFTP string displays ="ftp://xxx.com/123/Files/File1.zip"**All files to be copied exist |
 |
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2008-09-17 : 16:57:06
|
Sounds like you've got a permissions issue or incorrect path. Have you tried manually accessing the file using the same parameters?Tara KizerMicrosoft MVP for Windows Server System - SQL Serverhttp://weblogs.sqlteam.com/tarad/Subscribe to my blog |
 |
|
LOOKUP_BI
Constraint Violating Yak Guru
295 Posts |
Posted - 2008-09-17 : 17:05:47
|
Im able to go to the IE and key in the same path[remoteFTP] and get a pop up for my credentials from the ftp site.Key in the same user name and password and access the FTP site.and I can as well manually access the file that needs to be uploaded and the path is valid as well. |
 |
|
afrika
Master Smack Fu Yak Hacker
2706 Posts |
Posted - 2008-09-17 : 17:30:09
|
if you are getting an error 5** its an internal server error. File not found is error 404 |
 |
|
afrika
Master Smack Fu Yak Hacker
2706 Posts |
Posted - 2008-09-17 : 17:43:40
|
Question: are you using vb.net, or asp.net (vb) or ssis ?because if its .net you can simply upload the file .net namespaces |
 |
|
LOOKUP_BI
Constraint Violating Yak Guru
295 Posts |
Posted - 2008-09-18 : 08:33:46
|
Ive written this code in VB.Net and placed it in Script Task of an SSIS package. The intial plan was to just copy the weekly files that are processed to a folder on a drive.This works fine.Now we need to copy the file to the vendor's ftp instead.Any idea why its not working?Are there any namespaces that I'm missing? Ive added System.Net namespace. |
 |
|
rgombina
Constraint Violating Yak Guru
319 Posts |
Posted - 2008-09-18 : 09:52:40
|
try:Dim remoteFTP As String = "ftp://xxx.com/123/Files/"Dim User As String = "User1"Dim Password As String = "Password1"Dim localFile As String = "C:\" & System.IO.Path.GetFileName(file.FullName)My.Computer.Network.UploadFile(localFile, remoteFTP, User, Password, True, 500) |
 |
|
LOOKUP_BI
Constraint Violating Yak Guru
295 Posts |
Posted - 2008-09-18 : 13:13:25
|
I tried,Here is my code.I had to change it to suite my folder structure.localFile= "C:\NewFile\" & System.IO.Path.GetFileName(file.FullName)My.Computer.Network.UploadFile(localFile, remoteFTP, User, Password, True, 500)But I receive this error mssgThe address for UploadFile needs to include a file name.Both localFile & remoteFTP string shows the current address in the LOcal Window [as below]localFile =C:\NewFile\File1.zip |
 |
|
LOOKUP_BI
Constraint Violating Yak Guru
295 Posts |
Posted - 2008-09-18 : 13:30:14
|
If I replace the remoteFTP to remoteFtp= "ftp://xxx.com/123/Files/" & file.NamelocalFile= "C:\NewFile\" & System.IO.Path.GetFileName(file.FullName)My.Computer.Network.UploadFile(localFile, remoteFTP, User, Password, True, 500)I receive this error mssgThe remote server returned an error: (550) File unavailable (e.g., file not found, no access).In local,remoteFtp looks as remoteFTP: "ftp://xxx.com/123/Files/File1.zip" |
 |
|
rgombina
Constraint Violating Yak Guru
319 Posts |
Posted - 2008-09-18 : 13:36:07
|
try this:Dim remoteFTP As String = "ftp://xxx.com/123/Files/File1.zip"Dim User As String = "User1"Dim Password As String = "Password1"Dim localFile As String = "C:\" & System.IO.Path.GetFileName(file.FullName)My.Computer.Network.UploadFile(localFile, remoteFTP, User, Password, True, 500)Add: File1.zip on the remoteFTP line.Make sure you have permission to write on that folder.Similar siutation here: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=924595&SiteID=1 |
 |
|
LOOKUP_BI
Constraint Violating Yak Guru
295 Posts |
Posted - 2008-09-18 : 15:15:54
|
Im able to login,move,delete,copy files to the similar ftp using CoreFTP software.Im able to go to the ftp server by just adding the same url to IE.A window pops up asking me enter my credentials.Im able to login.I have tried the remotePath as "ftp://xxx.com/123/Files/" & file.NameThi gets displayed as below in Local Window."ftp://xxx.com/123/Files/File1.zip" |
 |
|
rgombina
Constraint Violating Yak Guru
319 Posts |
Posted - 2008-09-18 : 16:20:10
|
Just a thought... have you tried using FTP Task? It makes things easier in the long run since you are trying to copy all files exists (Foreach Loop) on that folder. FTP Task will give you visual connection else it will fail. |
 |
|
LOOKUP_BI
Constraint Violating Yak Guru
295 Posts |
Posted - 2008-09-18 : 16:31:51
|
Just tried creating an FTP Connection using the FTP Connection Mng.When trying to key in server name as "ftp://xxx.com/123/Files/".It error's out.Connection cannot be established.When I key in just the root of it "xxx.com" Im able to login with same user name & password.Could this be the reason Im not able to pass the entire FTP Path as the upload destination? What is the work around way for this as I need to copy the files to the 123/Files folder.Therefore I might need to open a connection to the FTP first and then be able to drill down to the folder and copy the files |
 |
|
LOOKUP_BI
Constraint Violating Yak Guru
295 Posts |
Posted - 2008-09-18 : 20:33:48
|
Im thinking to use FTP Task since I'm having lots of problem with the Script Task.Does anyone have any ideas on how I can only send files that have todays date in it to the Vendor.File names are similar to this format AA09182008.zip.There are 6 file in total,all file name's have todays date in [mmddyyyy] in it. |
 |
|
LOOKUP_BI
Constraint Violating Yak Guru
295 Posts |
Posted - 2008-09-25 : 13:38:55
|
Thanks all for your help.I manage to solve my problem by using this link.Now I'm able to upload files.http://msdn.microsoft.com/en-us/library/ms229715(VS.80).aspx |
 |
|
|