[PHP] Upload using FTP commands

2010-08-26 Thread Matthew Croud


Hi,

I want to give my client the ability to upload large files ( around  
20MB ) to a webspace.
I reckon that using the FTP commands of PHP would be the best bet, but  
is it possible to allow them to do this through an online form.


This is my vision: the client logs in to a form that has an upload  
button, and the upload button uses the FTP commands to upload the file.


Is that do-able in PHP ?

Cheers!







--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Upload using FTP commands

2010-08-26 Thread Dan McCullough
Take a look here:
http://us.php.net/manual/en/ref.ftp.php

You might have some issues with the memory limit in PHP so that might have
to be boosted for 20MB files.

On Thu, Aug 26, 2010 at 12:24 PM, Matthew Croud m...@obviousdigital.comwrote:


 Hi,

 I want to give my client the ability to upload large files ( around 20MB )
 to a webspace.
 I reckon that using the FTP commands of PHP would be the best bet, but is
 it possible to allow them to do this through an online form.

 This is my vision: the client logs in to a form that has an upload button,
 and the upload button uses the FTP commands to upload the file.

 Is that do-able in PHP ?

 Cheers!







 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Upload using FTP commands

2010-08-26 Thread Ashley Sheridan
On Thu, 2010-08-26 at 17:24 +0100, Matthew Croud wrote:

 Hi,
 
 I want to give my client the ability to upload large files ( around  
 20MB ) to a webspace.
 I reckon that using the FTP commands of PHP would be the best bet, but  
 is it possible to allow them to do this through an online form.
 
 This is my vision: the client logs in to a form that has an upload  
 button, and the upload button uses the FTP commands to upload the file.
 
 Is that do-able in PHP ?
 
 Cheers!
 
 
 
 
 
 
 

What would be the point?

You would have to set up your server to allow large files to be uploaded
in order for them to be used by PHP, and by that time, unless you're
putting them onto a remote server, there's no point in using the FTP
functions of PHP. What I've found quite reliable is to use PHP to create
FTP user accounts, which they can then log in to and upload files as
they need.

HTTP was not really intended for uploading large files, but FTP is, and
every OS has some form of FTP software built in that can be used very
easily.

Thanks,
Ash
http://www.ashleysheridan.co.uk




Re: [PHP] Upload using FTP commands

2010-08-26 Thread Adam Richardson
On Thu, Aug 26, 2010 at 12:37 PM, Ashley Sheridan
a...@ashleysheridan.co.ukwrote:

 On Thu, 2010-08-26 at 17:24 +0100, Matthew Croud wrote:

  Hi,
 
  I want to give my client the ability to upload large files ( around
  20MB ) to a webspace.
  I reckon that using the FTP commands of PHP would be the best bet, but
  is it possible to allow them to do this through an online form.
 
  This is my vision: the client logs in to a form that has an upload
  button, and the upload button uses the FTP commands to upload the file.
 
  Is that do-able in PHP ?
 
  Cheers!
 
 
 
 
 
 
 

 What would be the point?

 You would have to set up your server to allow large files to be uploaded
 in order for them to be used by PHP, and by that time, unless you're
 putting them onto a remote server, there's no point in using the FTP
 functions of PHP.


Ashley makes a nice point.  When I have control over the server, I don't use
PHP's FTP capabilities at all.  However, on some shared severs you're only
HTTP upload options are to set a directory to 777 (Yikes!), or do some work
with PHP's FTP functions.

What I've done in the past on shared hosts is setup an upload FTP account
that has access to one directory.  Then, I develop a form to upload the
file.  Once a file is uploaded, I use PHP's FTP functions to place the file
in the directory.  This way I avoid the security issues of 777, maintain an
easy-to-use interface (some clients don't want to use FTP), and continue to
use the hosting the client prefers.  There is a cost to this method, but
sometimes it's worth the cost.

Just another way of doing things.

Adam

-- 
Nephtali:  PHP web framework that functions beautifully
http://nephtaliproject.com