TRUSTAbyss -
Joined: 29 Oct 2003 Posts: 3752 Location: USA, GA
|
Posted: Mon Aug 08, 2005 10:14 am Post subject: ::File2FTP:: v1.0 | Beta Testing |
|
|
I created yet another PHP script. The newest PHP script that I wrote allows you
to select a local file and upload it to any live FTP Server on the internet. I want
to make it better but its currently in Beta and works great. Read Below!
You need to modify your php.ini settings before using this new script.
Open php.ini and change the following two directives that effect every
uploaded file , this will determine how big your uploads can be.
php.ini (Configuration)
Quote: |
; Maximum size of POST data that PHP will accept.
post_max_size = 50M
;;;;;;;;;;;;;;;;
; File Uploads ;
;;;;;;;;;;;;;;;;
; Maximum allowed size for uploaded files.
upload_max_filesize = 50M
|
Notice how the post_max_size is the same as upload_max_filesize , thats
because when your dealing with forms that use post , thats also effected.
The total allowed upload size is set to 50 MB in my example , you can put
whatever you feel is the right size , but I choose 50 MB's for video files. :-)
::File2FTP:: v1.0 Beta [file2ftp.php]
Code: |
<form action="file2ftp.php" method="post" enctype="multipart/form-data">
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td>Server: </td>
<td><input type="text" name="server"></td>
</tr>
<tr>
<td>Username: </td>
<td><input type="text" name="ftp_user"></td>
</tr>
<tr>
<td>Password: </td>
<td><input type="password" name="ftp_pass"></td>
</tr>
<tr>
<td>Choose File: </td>
<td><input type="file" name="file"></td>
</tr>
</table>
<input type="submit" name="submit" value="Upload">
</form>
<?php
// ::File2FTP:: v1.0 Beta
// No need to modify this code
// Created By: TRUSTpunk
if ($submit) {
$ftp_user = $_POST["ftp_user"];
$ftp_pass = $_POST["ftp_pass"];
$file = $_FILES['file']['name'];
$output = $_FILES['file']['tmp_name'];
$ftp_serv = ftp_connect($server);
ftp_pasv($ftp_serv, TRUE);
if (ftp_login($ftp_serv, $ftp_user, $ftp_pass)) {
ftp_put($ftp_serv, $file, $output, FTP_BINARY);
$list = ftp_nlist($ftp_serv, ".");
for ($n=0; $n < count($list); $n++) {
echo $list[$n] . "<BR>";
}
}else{
echo "I could not connect to the server.";
}
ftp_close($ftp_serv);
}
?> |
I hope you find alot of fun from using this awesome PHP script. I will
improve things in the future , enjoy sending files to your FTP server.
Note: This should buy me more time on ::File Limit:: :-)
Sincerely , TRUSTpunk |
|