transload via ftp

Started on the old forum in July 2013 · view the original in the archive · old links redirect here

#ftp #server #transload #upload

4 replies · 834 views · started 13 years ago · 1 min read

3 participants
pmbguy Senior · 344 posts #1

Ok, I wasn't gonna post this, but I was coding last week, n fiddling with uploading files via ftp to my server... So when I saw the transloader script, I figured why not post this too, updated the code a bit to add login to server, n here you guys go...

DEMO: http://sendthoselinks.tk

Added after 41 minutes:

oh... n if you look for this line...

$bob = ftp_pasv($connection, true);

that sets it to passive mode, since some servers require this... If your server doesn't work with passive mode, disable/remove this line... I left it in, cause I never used a server that doesn't accept passive mode...

Attachments: sendthoselinks.zip
just_m3. Developer · 199 posts #2

This is also file importer script 🙂 , hope you like this too ..

Posted this in my forum on a user request (Romanian lang)

<?php 
if(!empty($_POST['url'])&&
!empty($_POST['server'])&&
!empty($_POST['dir'])&&
!empty($_POST['user'])&&
!empty($_POST['pass']))
{
$file = $_POST['url'];
$ftp_server = $_POST['server'];
$dir = $_POST['dir'];
$ftp_user_name = $_POST['user'];
$ftp_user_pass = $_POST['pass'];

// open some file for reading
$fp = fopen($file, 'r');

// set up basic connection
$conn_id = ftp_connect($ftp_server);

// login with username and password
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);

$name = explode("/",$file);
$name = $name[count($name)-1];
$name = explode("?",$name);
$name = $name[0];

// try to upload $file
if (ftp_fput($conn_id,$dir."/".$name,$fp,FTP_BINARY)) {
    echo "Successfully uploaded $file\n";
} else {
    echo "There was a problem while uploading $file\n";
}

// close the connection and the file handler
ftp_close($conn_id);
fclose($fp);
}

else{
echo'<form action="" method="post">
Fisier:<br/><input type="text" name="url"><br/>
Server:<br/><input type="text" name="server"><br/>
Folder:<br/><input type="text" name="dir" value="/public_html"><br/>
User:<br/><input type="text" name="user"><br/>
Parola:<br/><input type="text" name="pass"><br/>
<input type="submit" name="Import">
</form>
';
}
?>

This is ten percent luck, twenty percent skill Fifteen percent concentrated power of will Five percent pleasure, fifty percent pain 😂And a hundred percent reason to remember the name!

Attachments: import.zip screenshot.png
almahmud Newbie · 8 posts #4

pmbguy wrote: Ok, I wasn't gonna post this, but I was coding last week, n fiddling with uploading files via ftp to my server... So when I saw the transloader script, I figured why not post this too, updated the code a bit to add login to server, n here you guys go...

DEMO: http://sendthoselinks.tk

Added after 41 minutes:

oh... n if you look for this line...

$bob = ftp_pasv($connection, true);

that sets it to passive mode, since some servers require this... If your server doesn't work with passive mode, disable/remove this line... I left it in, cause I never used a server that doesn't accept passive mode...

: set_time_limit() has beenWarning disabled for security reasons in/ home/u800315943/public_ html/transloader/index.php on line51 Error!!! Must enter URL to file...ftp.lifebd24.com FTP upload failed! Warning: ftp_close() expects parameter 1 to be resource, null given in/home/u800315943/ public_html/transloader/ index.php on line96

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close