Upload files on file server in intranet in php - 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.
As the second one is a file server so there should no need to install php on that server.
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. But that is not working in Intranet however, it is perfectly working with any live server ftp credentials.
If I use CURL then I have to install PHP on my file server, but that is not a good practice. So how I can upload the files using php ftp related methods?
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. This way you can upload files by copying or moving them locally, no need to muck around with FTP or SSH modules in PHP.

Related

FTP client side upload how?

I have a simple php local sever with xampp,
Ftp Server with included fileZilla.
I have designed a site to upload files is there a way to upload files directly to ftp from my site without first uploading it to the server? Currently in using the normal html form go upload the file.
The form doesn't upload large files.. I tried with a 350mb file and the connection timed out..
Is there a way to upload the file to ftp server directly from the website (no 3rd party software on client)
UPDATE (29/13/17)
My problem was solved by using php only. I can upload large files now.
How ever the question is still unanswered.
In your ftp its easy to upload files. You can see a tutorial from youtube like
In this tutorial using filezilla. Its fine ftp softwere

how to upload files through cpanel?

I am using godaddy for hosting and have linux hosting with cPanel account. How I will upload my css,images,js folders? What is the use of cgi-bin folder as it is already set under public_html folder?
The better way is do not using c-panel for uploading event there is file manager. The best way is if you by using c-panel create ftp-account for your self. After that by ftp client you'll be able to upload or download what you like. Also by connecting via ftp your preferred php/html editor you'll be able to edit the files on fly.
cgi folder is dedicated for executive scripts or binaries. These scripts are executed outside of web server - execution is in core unix system.

XAMPP Security and Remote Access

Hello I am running tests on my XAMPP server.
Let's say we have the following scenario :-
My Laptop is running the server in a small Local Network.
And I am accessing my Server with my personal PC.
Is it possible to upload files to htdocs from my Personal PC to the Server Laptop?
If we assume that all security settings are turned off. Basically I need to remotely upload files to HTDOCS so I can use them from the server!
As far as I remember doesnt XAMPP come with a FileZilla server as part of the install?
So configure the fileZilla server on the laptop, create a userid and set that userid up to be able to see the htdocs folder.
Then install FileZilla client on the desktop PC. You can then use FTP ( FileZilla ) in just the same way you would if the site was running on a real hosted server.
FileZilla Server setup instuctions
No.
Web servers do not, by default, run any services that write file uploads to a directory on the server.
You'll need to run some kind of suitable service such as SFTP, Windows File & Print Sharing, or a web based file uploader script.

Upload file from local server to web server using codeigniter

I have a client database that generates and stores reports on a local server and I would like these reports to be able to be accessed by a publicly accessible remote server.
The local server runs windows, and I am running a unix installation on the remote server.
The public side is built with codeigniter, and the local side is proprietary php code. How would I go about transferring files onto the remote server?
I am not looking for somebody to write the code for me, but if you could provide a general example, or point me in the right directon it would be greatly appreciated.
You can use CURL to send file in background to local server to other server, Here is good example.
How to send upload file to other website by using curl in php?
I ended up installing winSCP on my local windows server, then from the php file using shell_exec to call a batch file with commands to transfer the file.

php file_get_contents ('....datafile.xml') - get the datafile from my local desktop?

I have a database that exports xmls only locally (to my computer). It will not export to a remote server.
I have a php file (located on remote server) that sends the xml to a webserivce.
Can I have the remote php file use "file_get_contents" function to extract xml data from my local computer?
If so, what is the proper syntax?
Thanks in advance.
I think you should add a file upload page,upload the local xml file to remote server,the do the the next work.
You have a couple of options...
You could run a local web server on your computer and publish the files via that. Your remote PHP script could then read the file.
A potentially better alternative would be to use something like Dropbox. Save the database files in your Dropbox folder. They will be automatically uploaded to the Dropbox cloud storage.
Your remote PHP script could then retrieve them via the Dropbox API or if they are in the "public" folder, directly via URL.
You have to make your file available from your linux machine:
install a webserver on your desktop machine and allow it to expose the file, so the file will be available to an URI like http://ip_of_your_desktop/path_to_files/filename.xml (this was mentioned above also)
if your desktop and server are on the same network, share the folder on your desktop, mount the folder on your linux machine and use file_get_contens to read the file from the mounted location

Categories