简体   繁体   English

从授权部分下载FTP文件

[英]Downloading FTP file from authorized section

I have a PHP website on IIS 8, with authorized section. 我在IIS 8上有一个PHP网站,带有授权部分。

I'd like to add a functionality so that logged in users can download files, for which have rights (information about files assigned to user are stored in database). 我想添加一个功能,以便登录的用户可以下载具有权限的文件(有关分配给用户的文件的信息存储在数据库中)。

These files are stored on authorized FTP server (file size is 10MB-500MB). 这些文件存储在授权的FTP服务器上(文件大小为10MB-500MB)。

I'd like to ask if there is some way to download just the file user has rights to, for example I was thinking about generating some unique link to a file so the user can download it, but without logging to FTP server. 我想问问是否有某种方法可以只下载用户有权访问的文件,例如,我正在考虑生成指向文件的唯一链接,以便用户可以下载该文件,但无需登录到FTP服务器。

If each user already has a login to the FTP server and the permissions are setup correctly on their folders - you could integrate a PHP FTP section relatively easily which uses the logged in users (of the website) FTP credentials, presuming you have them in the database and just traverse the folders returned from ftp_nlist() 如果每个用户都已经登录到FTP服务器,并且在其文件夹上正确设置了权限-您可以相对容易地集成一个PHP FTP部分,该部分使用(网站的)登录用户的FTP凭据,假设您已将它们保存在数据库并遍历从ftp_nlist()返回的文件夹

http://php.net/manual/en/function.ftp-nlist.php http://php.net/manual/zh/function.ftp-nlist.php

Here is a tutorial covering, logging in, retrieving directory contents and getting a file - the 3 things you will need 这是一个涵盖,登录,检索目录内容和获取文件的教程-您将需要的三件事

http://www.dreamincode.net/forums/topic/19945-basic-ftp-tutorial/ http://www.dreamincode.net/forums/topic/19945-basic-ftp-tutorial/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM