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

x
?
Solved

VB INET - PUT FILE TO SUBFOLDER ON FTP SITE

Posted on 2006-11-21
7
Medium Priority
?
1,537 Views
Last Modified: 2012-05-05
I have an ftp script which is working, but does not allow me to place a file in a subfolder of the FTP site. I have tried various methods but none seem to function. I basically have a subfolder called IN within the ftp main folder which i need to save a file to. Any assistance would be appreciated. I have tried adding  - & "/IN/" - to the host_name, but this is ignored and the file is saved in the root directory. My code is below.

Private Function UploadFile(ByVal source_file As String, _
    ByVal dest_file As String, ByVal host_name As String, _
    ByVal user_name As String, ByVal passwd As String) As _
    Boolean
   

    On Error GoTo UploadError


    If LCase$(Left$(host_name, 6)) <> "ftp://" Then _
        host_name = "ftp://" & host_name
       

     InetFTP.URL = host_name
     InetFTP.UserName = user_name
     InetFTP.Password = passwd


    InetFTP.Execute , "Put " & source_file & " " & dest_file
   
     
    UploadFile = True
    Exit Function

UploadError:
    MsgBox "Error " & Err.Number & _
        " uploading file '" & _
        source_file & "' to '" & _
        dest_file & "'." & vbCrLf & Err.Description, _
        vbExclamation Or vbOKOnly, _
        "Download Error"
    UploadFile = False
    Exit Function
End Function
0
Comment
Question by:WMfxms
[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
7 Comments
 
LVL 20

Expert Comment

by:hes
ID: 17990215
Try
InetFTP.Execute , "CD IN"  before your put
0
 

Author Comment

by:WMfxms
ID: 17990574
I get still executing last request error
0
 

Author Comment

by:WMfxms
ID: 17990680
placing - & "IN\" - before - & dest_file- did the job...

Seems like a bit of a schoolboy error really... :)

0
 
LVL 4

Expert Comment

by:JRCSystems
ID: 17992608
I am not positive, BUT, here's a thought...

Microsoft, in its Infinite wisdom in the Implementation of the INET control, and PUT and GET commands...
Well, basically, they DONT WORK if the source or destination have SPACES in the file names because the SPACE is a delimiter in the GET/PUT syntax...

So, cheat.

If your source file has a space in it, copy it to a temp area into a filename without spaces.
Your destination name cannot have a space in it either.

As far as specifying the folder name in the destination, that works just fine, I'd suggest the "/" forward slash.

Hope that helps.
0
 
LVL 1

Accepted Solution

by:
DarthMod earned 0 total points
ID: 18449444
PAQed with points refunded (500)

DarthMod
Community Support Moderator
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

636 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