I'm actually pursuing two different methods, first is the move_uploaded_file() method, and next is the ftp_put method(). I'm gonna outline what I know below, just in case there is a flaw in my logic somewhere.
In the first case, I use a standard html form, with an input with type=file:
><FORM ACTION='ftp.php?submit=1' METHOD='POST' ENCTYPE="MULTIPART/FORM-DATA">
<INPUT TYPE="FILE" NAME="file">
<BUTTON TYPE="SUBMIT">UPLOAD</BUTTON>
</FORM>
Once the user clicks on the Upload button, I run this script:
>$upload_dir = "public_html/uploads/"
$filename = $_FILES['file']['name'];
$tempname = $_FILES['file']['tmp_name'];
move_uploaded_file($tempname, $upload_dir . $filename);
I basically just copied the example off of the php manual for handling file uploads: PHP Manual: Handling File Uploads
I tried this locally on my laptop with IIS and PHP, and it works, but it doesn't work on my TCH site. I figure that the problem is either that I need the full path to my account, OR this method is just not supported by TCH.
So I then tried PHP's ftp methods. I didn't even use any kind of form:
>$ftp_connection = ftp_connect($ftp_server);
$login = ftp_login($ftp_connection, $ftp_username, $ftp_password);
ftp_put($ftp_connection, "/public_html/uploads/file.doc", "C:\file.doc", FTP_BINARY);
That's it. Again, the code is pretty much lifted off the PHP manual. The problems I see here are that I might just need the full path to my folder on the TCH server, or my reference to "C:\file.exe" is just wrong ... I only know the basic differences between the Linux and Windows directory structures ("\" vs. "/", Windows has drive letters), so I might just be missing something there.
Thanks for any help on this guys! I'd also appreciate it if the forum moderators could chime in on whether ftp is enabled on the php, and whether or not I do need the full path.
Aaron