• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 235
  • Last Modified:

Ftp ~ ala Connect Network drive

Hi there

Short question, but probaly rather dificult :-(

Is there a way to connect a FTP page as connecting a network drive, so you can browse the FTP page as your own drive (I only need to download files from the page)
0
koger
Asked:
koger
  • 3
  • 2
1 Solution
 
BoRiSCommented:
koger

This is possible I have seen it done in ipswitch FTPPro, when you connect to an FTP site it adds it into your windows explorer as a "Mapped Drive" and you can browser the FTP from there, Maybe what you can do is once connect map a network drive to this connection then explorer etc will look at it as a drive until the connection is killed, you could use the API call WNetAddConnection2W like so

  function WNetAddConnection2W(var lpNetResource: TNetResourceW;
    lpPassword, lpUserName: PWideChar;
    dwFlags: DWORD): DWORD; stdcall;

then map the network drive from a button click or so...

procedure TForm1.Button1Click(Sender: TObject);
var
  NRW: TNetResource;
begin
  with NRW do
  begin
    dwType := RESOURCETYPE_ANY;
    lpLocalName := 'X:'; // map to this driver letter
    lpRemoteName := '\\MyServer\MyDirectory';
    // Must be filled in.  If an empty string is used,
    // it will use the lpRemoteName.
    lpProvider := '';
  end;
  WNetAddConnection2(NRW, 'MyPassword', 'MyUserName',
    CONNECT_UPDATE_PROFILE);
end;

Once you have the connection and the mapped drive execute windows explorer

ShellExecute(Handle, 'open', 'explorer.exe', 'Your mapped drive here', '', SW_SHOWNORMAL);

and you should have a mapped drive to the connection which will allow you to browse it in the windows explorer...

Hope this is what you are after...

Later
BoRiS
0
 
kogerAuthor Commented:
Hi, sorry for the long reply.

lpRemoteName := '\\MyServer\MyDirectory';

Isn't this a network adresse.

Where should I put the Host adresse.
0
 
BoRiSCommented:
koger

right were the lpProvider space is...

lpProvider := 'ftp://ftp.cdrom.com';

lpRemoteName is npnc (\\...\...) but this is required for the mapped drive to map correctly
you could connect to the server and then retrieve the directory and pass it to the lpRemoteName

Later
BoRiS
0
 
kogerAuthor Commented:
Oh, okay, just make an answer so can get your points ;-)
0
 
BoRiSCommented:
koger

Here you go, as asked just an answer for the points...

Later
BoRiS
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now