TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 06-14-2008, 04:43 PM   #1 (permalink)
Jmz
The Acquainted
 
Join Date: Oct 2007
Location: Newcastle, UK
Posts: 113
Thanks: 3
Jmz is on a distinguished road
Default Copy/Backup Folder

Is there a way I can copy a certain folder and its contents to a users computer using php?
__________________
Free CSS Tutorials
Send a message via MSN to Jmz
Jmz is offline  
Reply With Quote
Old 06-14-2008, 06:03 PM   #2 (permalink)
The Wanderer
 
Tree's Avatar
 
Join Date: Jun 2008
Location: Atlanta, USA
Posts: 8
Thanks: 1
Tree is on a distinguished road
Default

If you use the user's computer as an FTP server you can. You also could zip it up and serve it for downloading.
Send a message via ICQ to Tree Send a message via AIM to Tree Send a message via MSN to Tree Send a message via Yahoo to Tree
Tree is offline  
Reply With Quote
Old 06-14-2008, 07:34 PM   #3 (permalink)
Jmz
The Acquainted
 
Join Date: Oct 2007
Location: Newcastle, UK
Posts: 113
Thanks: 3
Jmz is on a distinguished road
Default

I'm not sure if we're talking about the same thing here.

When a user registers on my website it automatically creates a folder for them. Every time they upload a file it gets put into their folder. I want the user to be able to click a button in their cp and download a backup of all their files. Is this possible?
__________________
Free CSS Tutorials
Send a message via MSN to Jmz
Jmz is offline  
Reply With Quote
Old 06-14-2008, 07:38 PM   #4 (permalink)
La Vida es Sueño
Advanced Programmer Top Contributor 
 
Wildhoney's Avatar
 
Join Date: Sep 2007
Location: Oldham
Posts: 2,280
Thanks: 90
Wildhoney is on a distinguished road
Default

Tree is right. You could use the ZIP archive module for doing that. The Linux method looks far easier to me, as given as an example on the PHP.net page:

php Code:
// Get the date
$date = date("m-d-y");

// Make Zip name
$zipname = "archive/site-script-backup." . $date . ".zip";

// Make a zip file
$cmd = `zip -r $zipname *`;
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
Send a message via AIM to Wildhoney Send a message via MSN to Wildhoney Send a message via Yahoo to Wildhoney
Wildhoney is offline  
Reply With Quote
Old 06-14-2008, 07:41 PM   #5 (permalink)
Jim
The Addict
 
Jim's Avatar
 
Join Date: Nov 2007
Location: the Netherlands
Posts: 281
Thanks: 2
Jim is on a distinguished road
Default

I wouldnt create folders for everyone, that way everybody can find files of another user. I would save files by a file_id and link the user with a file by a database. That way you won't have to worry about all the file handling, just uploading and deleting files. "Eitje" as we would say here in the netherlands :>
__________________
Nunchaku! Who doesn't like martial arts? =)
Send a message via MSN to Jim Send a message via Skype™ to Jim
Jim is offline  
Reply With Quote
Old 06-14-2008, 07:46 PM   #6 (permalink)
The Wanderer
 
Tree's Avatar
 
Join Date: Jun 2008
Location: Atlanta, USA
Posts: 8
Thanks: 1
Tree is on a distinguished road
Default

Quote:
Originally Posted by Jmz
I'm not sure if we're talking about the same thing here.

When a user registers on my website it automatically creates a folder for them. Every time they upload a file it gets put into their folder. I want the user to be able to click a button in their cp and download a backup of all their files. Is this possible?
In that case using FTP isn't an option. But you can still just zip/tar the user's folder and serve it. This PHP Class looks like it would work for this.
__________________
NCIDev.com
Send a message via ICQ to Tree Send a message via AIM to Tree Send a message via MSN to Tree Send a message via Yahoo to Tree
Tree is offline  
Reply With Quote
Old 06-14-2008, 09:12 PM   #7 (permalink)
Jmz
The Acquainted
 
Join Date: Oct 2007
Location: Newcastle, UK
Posts: 113
Thanks: 3
Jmz is on a distinguished road
Default

Thanks for that :) I was a bit confused when you mentioned FTP.

As for people being able to find the files of other users, it shouldn't be a problem because the files will only be images to display in a gallery anyway.
__________________
Free CSS Tutorials
Send a message via MSN to Jmz
Jmz is offline  
Reply With Quote
Old 06-14-2008, 09:17 PM   #8 (permalink)
The Wanderer
 
Tree's Avatar
 
Join Date: Jun 2008
Location: Atlanta, USA
Posts: 8
Thanks: 1
Tree is on a distinguished road
Default

No problem. I originally thought you wanted to build a script that backed things up to just your computer.
__________________
NCIDev.com
Send a message via ICQ to Tree Send a message via AIM to Tree Send a message via MSN to Tree Send a message via Yahoo to Tree
Tree is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 02:00 AM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design