October 18, 201610 yr How can I write a php file to download an entire folder onto my computer from my website?
October 19, 201610 yr SSH is the way, but if You wan't use FTP, SSH will not for sure. Mayby WinHTTrack ? Threre is option to dowload files from the web.
October 19, 201610 yr Author SSH is the way, but if You wan't use FTP, SSH will not for sure. Mayby WinHTTrack ? Threre is option to dowload files from the web. How can I write a php file to download an entire folder onto my computer from my website?
October 19, 201610 yr You can't. The only way to access php files is via the server. You can do this using your control panel file manager, FTP, subversion, SSH or some other terminal application. PHP are not client facing. There is no direct access from a browser. Edited October 19, 201610 yr by fisicx
October 19, 201610 yr You can't. The only way to access php files is via the server. You can do this using your control panel file manager, FTP, subversion, SSH or some other terminal application. PHP are not client facing. There is no direct access from a browser. PHP has access to the filesystem, it's server-side, so this should be possible. Edited October 19, 201610 yr by Jack
October 19, 201610 yr What I should have said you can't just download the files - you need to authorised access. If it were easy to link directly to the files it would pretty much invalidate every website that uses php - there would be no security. Authorised access comes via one of the methods I listed above. You could write a script to do the job for you but it would still need username and password and if you have that you might just as well use an FTP client.
October 19, 201610 yr What I should have said you can't just download the files - you need to authorised access. If it were easy to link directly to the files it would pretty much invalidate every website that uses php - there would be no security. I could be talking about something different, but I've seen plenty of scripts that don't require authentication, other than the download file existing on your server. http://stackoverflow.com/questions/12094080/download-files-from-server-php It won't let you download outside of the current directory though. Any system that lets you download a folder or file is technically doing this, so it's definitely possible without a username / password or SSH key.
October 19, 201610 yr You can just use the command line to pull down files from a server that you have SSH access to using wget command. Building a script to do this is excessive. Edited October 19, 201610 yr by rbrtsmith
October 19, 201610 yr I could be talking about something different, but I've seen plenty of scripts that don't require authentication, other than the download file existing on your server. downloadable files (html, css, js, jpg, pdf etc) you can get. php, asp, net file you can't. As Robert says, you can do this via a command line or any other method I listed but in each case you need permission/authorisation to do so. I suspect @@gigman7 doesn't have access which is why he wants to download the folder using a script - and that's just not going to happen.
October 19, 201610 yr Smells like someone wants to take a copy of a website. Yes you could write a script to bundle everything in a directory into one big zip and download it. Thing is the script would need to be uploaded to the server in order to execute with permissions and create the bundle, thus you'd still require some method of file transfer with a username / password etc. And if you had this access then any other method would be easier to download the directory. Some hosts have file manager, so maybe if hosted on one of those, however still back to a username and password issue.
October 19, 201610 yr downloadable files (html, css, js, jpg, pdf etc) you can get. php, asp, net file you can't. As Robert says, you can do this via a command line or any other method I listed but in each case you need permission/authorisation to do so. I suspect @@gigman7 doesn't have access which is why he wants to download the folder using a script - and that's just not going to happen. Ah right, yeah that makes sense.
October 20, 201610 yr Author downloadable files (html, css, js, jpg, pdf etc) you can get. php, asp, net file you can't. As Robert says, you can do this via a command line or any other method I listed but in each case you need permission/authorisation to do so. I suspect @@gigman7 doesn't have access which is why he wants to download the folder using a script - and that's just not going to happen. I have access. I have a way of doing it on my work computer one at a time. But with 1700 files, that would just take WAY too long. I have done this before with images moving them from one site to another, even when I didn't have the authorization. I just can't remember how or even if this would work moving them from site to computer.
October 20, 201610 yr You can move images because they are accessible. You can't move php files the same way. If you want to move a folder with php files you need to use FTP, SSH, subversion or you cpanel file manager.
October 21, 201610 yr Author You can move images because they are accessible. You can't move php files the same way. If you want to move a folder with php files you need to use FTP, SSH, subversion or you cpanel file manager. I don't want to copy php files. I actually want to move some mp3 files.
October 31, 201610 yr Author I have been able to copy images fro m one web page to another by reading the image files. I do not remember how I did that though.
December 1, 20169 yr Author I would need it to work similar to how pinterest copies images from one site to theirs. Except I need to move mp3 files.
Create an account or sign in to comment