PHP Uploader: How to set upload path to local computer?

917 Views Asked by At

How can I set my uploader to save uplodaded files into folder on my computer? I'm hosting a free server on 000webhost.com and I have a simple uploader script ^^ So I'd like to do something like this:

//specify folder for file upload
$folder = "C:\Users\Tepa\Desktop\Ohjelmat\Uploads"; 
2

There are 2 best solutions below

0
On

In order to have a website save files on your local computer, you will need to install a ftp or other fileserver on your home computer and send the file by IP address, or DNS address.

0
On

I would suggest instead to tackle this from the opposite direction and write a script to pull these files to your local computer rather than open it up to the outside world. You can set it up as either a cron job / scheduled task so that the files are pulled in automatically.

If the files you are interested in are stored in a publicly accessible folder on your host, actually accomplishing this task is fairly trivial (see: cURL or file_get_contents)

You loose the real-time synchronicity, but gain some peace of mind.