Download via FTP with Javascript

Asked

Viewed 486 times

2

I would like to know how I can be putting on my page the user option to download via FTP. I do not want the user to enter the information for access to FTP and also that he does not see the FTP data he is accessing to download.

Is that possible? If so, how can I proceed ?

  • Put a LINK like this: www.dominio.com.br/folder/file.rar

  • 1

    Diego thanks for the more attention this way did not work

  • Without having a way to see the data is impossible, there is no way to access the FTP without the address, and in case it needs user and password these will have to be somewhere that however much you try to hide will have to be used by the browser to download the file, so can be discovered.

1 answer

1

It is even possible to do it, but in the most current browsers you get a confirmation screen stating that it may be a possible fraud.

inserir a descrição da imagem aqui

Follow the passage:

var username = 'user';
var password = 'pass';
var server = 'toSomeServer';
window.open("ftp://" + username + ":" + 
      password + "@" + server, '_blank', 
      'toolbar=no,location=no,status=no,' + 
      'scrollbars=auto,copyhistory=no,menubar=no,width=' 
      + ((screen.AvailWidth/2)-12) + ',height=' 
      + (screen.AvailHeight-124) +',left=' + ((screen.AvailWidth/2)) 
      + '),top=0,resizable=yes');

I don’t think that’s the most elegant solution to this.

One good alternative would be you treat that in serverside. On the website of Wc3 has an example connection with PHP.

I hope I’ve helped.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.