简体   繁体   English

在PHP的Intranet中的文件服务器上上传文件

[英]Upload files on file server in intranet in php

I am maintaining two local servers on local network (within the office premises). 我正在本地网络上(办公室内)维护两个本地服务器。

One is the server where my php files are being located and another server is a File Server where I want to store all the uploaded files. 一台是我的php文件所在的服务器,另一台是我要存储所有上载文件的文件服务器。 As the second one is a file server so there should no need to install php on that server. 由于第二个是文件服务器,因此无需在该服务器上安装php。

How I can upload the files to another server. 如何将文件上传到另一台服务器。 I have the full rights to access the file server. 我拥有访问文件服务器的完整权限。 I tried to use ftp_connect() method. 我尝试使用ftp_connect()方法。 But that is not working in Intranet however, it is perfectly working with any live server ftp credentials. 但这在Intranet中不起作用,它可以与任何实时服务器ftp凭据完美配合。

If I use CURL then I have to install PHP on my file server, but that is not a good practice. 如果使用CURL,则必须在文件服务器上安装PHP,但这不是一个好习惯。 So how I can upload the files using php ftp related methods? 那么如何使用php ftp相关方法上传文件?

How I can upload the files to file server. 如何将文件上传到文件服务器。 Thanks in advance. 提前致谢。

Since in your case both client and server are Unix systems, the easiest is to mount a directory of the file server on the web server by NFS. 因为在您的情况下,客户端和服务器都是Unix系统,所以最简单的方法是通过NFS在Web服务器上安装文件服务器的目录。 This way you can upload files by copying or moving them locally, no need to muck around with FTP or SSH modules in PHP. 这样,您可以通过在本地复制或移动文件来上传文件,而无需在PHP中使用FTP或SSH模块。

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

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