ftp & php file upload

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
wapchimp
Forum Newbie
Posts: 3
Joined: Sun Dec 19, 2004 8:54 am

ftp & php file upload

Post by wapchimp »

My web & php knowledge levels are failry low :oops:

OK I have just got a neat php file upload script working here;
http://www.wapchimp.pwp.blueyonder.co.uk/fileupload/

I have some questions;

Is there some way to move (copy/paste) files from one web directory to another, does an ftp server allow this because I can't seem to do it.

Is there any other way to move these files from the storage directory to another. I have php, mysql etc on my host.

The reason I ask is that I have broadband, and free unlimited storage & bandwidth etc with my web host. The only snag is I HAVE TO dial in to their ftp server or I cannot access it. Hence the need for a php file upload to by-pass this. I just need to know if I can move these file around on the server.

Thanks for your help
User avatar
neophyte
DevNet Resident
Posts: 1537
Joined: Tue Jan 20, 2004 4:58 pm
Location: Minnesota

mv shell command

Post by neophyte »

Code: Select all

<?php
   exec("mv /absolute/path/to/file.txt /absolute/path/to/new/location/file.txt");
// If moving an entire directory it would be mv -R /paths/ /new/paths/
?>
wapchimp
Forum Newbie
Posts: 3
Joined: Sun Dec 19, 2004 8:54 am

Post by wapchimp »

Thanks neophyte

Where exactly do I put this code?

Thanks
User avatar
neophyte
DevNet Resident
Posts: 1537
Joined: Tue Jan 20, 2004 4:58 pm
Location: Minnesota

Post by neophyte »

In a file: something.php
Upload the file to the server and then go to it with your browser.

:roll:
wapchimp
Forum Newbie
Posts: 3
Joined: Sun Dec 19, 2004 8:54 am

Post by wapchimp »

8O
theres me thinking it would be tricky :oops:

cheers
Post Reply