Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 12 of 12
  1. #1
    New to the CF scene
    Join Date
    Nov 2010
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Smile Remote Upload Code Upgrade

    Hello,

    I found this code before and I have been using it for some time.

    it is for downloading/uploading files to my server remotely

    however every link I want to upload/download to my server, I have to edit the php file and add the URL then open the PHP file.

    is there any way to make it easier?

    just like in Rapidshare's remote upload, you copy and paste multiple links, paste them in a text box and then click "Start" and it starts downloading all of the files one by one to the server.

    here's the code:

    PHP Code:
    <?php
    define
    ('BUFSIZ'4095);
    $url 'LINK HERE';
    $rfile fopen($url'r');
    $lfile fopen(basename($url), 'w');
    while(!
    feof($rfile))
    fwrite($lfilefread($rfileBUFSIZ), BUFSIZ);
    fclose($rfile);
    fclose($lfile);
    ?>
    Last edited by PeeItchPee; 11-19-2010 at 10:51 PM.

  • #2
    Senior Coder
    Join Date
    Sep 2010
    Posts
    2,178
    Thanks
    15
    Thanked 253 Times in 253 Posts
    It doesn't look like it would be very difficult to add a form input to put the URL into the code. Looks like a kind of fun little project to me. Make it so that if the form isn't submitted the code doesn't run, then when you submit the URL it does it's thing.

  • #3
    New to the CF scene
    Join Date
    Nov 2010
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by DrDOS View Post
    It doesn't look like it would be very difficult to add a form input to put the URL into the code. Looks like a kind of fun little project to me. Make it so that if the form isn't submitted the code doesn't run, then when you submit the URL it does it's thing.

    Yep

  • #4
    New to the CF scene
    Join Date
    Nov 2010
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hope you didn't forget =[

  • #5
    Senior Coder
    Join Date
    Sep 2010
    Posts
    2,178
    Thanks
    15
    Thanked 253 Times in 253 Posts
    Quote Originally Posted by PeeItchPee View Post
    Hope you didn't forget =[
    I didn't think you wanted someone to do it, just wanted an idea that would work. I don't have enough of the code to actually make what you have there work, I need to have a look at all the code that makes that function to really write something for it.

  • #6
    New to the CF scene
    Join Date
    Nov 2010
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by DrDOS View Post
    I didn't think you wanted someone to do it, just wanted an idea that would work. I don't have enough of the code to actually make what you have there work, I need to have a look at all the code that makes that function to really write something for it.
    lol yeah I wanted someone to do it, sorry I wasn't clear, and I have no clue about PHP codes lololol

    sorry maybe I didn't understand you but that's all of the code mate, nothing else.
    Last edited by PeeItchPee; 11-22-2010 at 07:54 AM.

  • #7
    New Coder
    Join Date
    Dec 2009
    Posts
    32
    Thanks
    1
    Thanked 3 Times in 3 Posts
    there is rentacoder, getafreelancer, etc websites. or there are thousands of free online resources to do just what you are looking for

  • #8
    Senior Coder
    Join Date
    Sep 2010
    Posts
    2,178
    Thanks
    15
    Thanked 253 Times in 253 Posts
    PHP Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"

    "http://www.w3.org/TR/html4/loose.dtd">

    <html>

    <head>

    <meta content="text/html; charset=utf-8" http-equiv="content-type">

    <script type="text/javascript">

    //Alerts to errors.

    window.onerror=function(msg, url, linenumber){var logerror='Error message: ' + msg + '. Url: ' + url + 'Line Number: ' + linenumber;alert(logerror);return false}

    </script>

        <title>Upload Form</title>

    <style type="text/css">

    body

    {

    margin: 0 auto;

    width:900px;

    font-family:serif

    }

    #upload_box

    {

    background-color: LightBlue;

    border:1px solid Black;

    padding:20px;

    margin-top:40px;

    width: 50%;

    }

    </style>

    <?php

    if (isset($_POST['myupload']))

    {

    define('BUFSIZ'4095);

    $url $_POST['upload'];

    $rfile fopen($url'r');

    $lfile fopen(basename($url), 'wb');

    while(!
    feof($rfile))

    fwrite($lfilefread($rfileBUFSIZ), BUFSIZ);

    fclose($rfile);

    fclose($lfile);

    }

    ?> 

    <script type="text/javascript"></script>

    </head>

    <body>

    <div id="upload_box">

    <form action="" method="post">

    <input type="text" name="upload">

    <input type="submit" name="myupload" value="Upload File">

    </form>

    </div>

    </body>

    </html>
    Well, I coded it anyway, looks like a useful little item, just put it in the folders you want to upload the files too. Only does one file at a time now, I will probably revise it to do a list of files later.

  • #9
    Senior Coder
    Join Date
    Sep 2010
    Posts
    2,178
    Thanks
    15
    Thanked 253 Times in 253 Posts
    Added a textarea and a loop to upload multiple files. Quick and dirty but tested. Just make a list of the URLs and paste it in.
    PHP Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"

    "http://www.w3.org/TR/html4/loose.dtd">

    <html>

    <head>

    <meta content="text/html; charset=utf-8" http-equiv="content-type">

    <script type="text/javascript">

    //Alerts to errors.

    window.onerror=function(msg, url, linenumber){var logerror='Error message: ' + msg + '. Url: ' + url + 'Line Number: ' + linenumber;alert(logerror);return false}

    </script>

        <title>Upload Form</title>

    <style type="text/css">

    body

    {

    margin: 0 auto;

    width:864px;

    font-family:serif

    }

    #upload_box

    {

    background-color: LightBlue;

    border:1px solid Black;

    padding:20px;

    margin-top:40px;

    }

    </style>

    <?php

    if (isset($_POST['myupload']))

    {

    $links_list $_POST['upload'];

    $incr 0;

    $links explode("\r\n",$links_list);

    define('BUFSIZ'4095);

    for ( 
    $incr == $incr count($links) ; $incr++ )

    {

    $url $links[$incr];

    $rfile fopen($url'r');

    $lfile fopen(basename($url), 'wb');

    while(!
    feof($rfile))

    fwrite($lfilefread($rfileBUFSIZ), BUFSIZ);

    fclose($rfile);

    fclose($lfile);

    }

    }

    ?> 

    <script type="text/javascript"></script>

    </head>

    <body>

    <div id="upload_box">

    <form action="" method="post">

    <textarea name="upload" cols=80 rows=20></textarea>

    <input type="submit" name="myupload" value="Upload Files">

    </form>

    </div>

    </body>

    </html>

  • #10
    New to the CF scene
    Join Date
    Nov 2010
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    For some reason, on both of your codes..
    the downloads are really slow and I get "Internal Server Error"

    but with the code i have, very fast with no errors.

  • #11
    Senior Coder
    Join Date
    Sep 2010
    Posts
    2,178
    Thanks
    15
    Thanked 253 Times in 253 Posts
    I just tried it on remote ( non-localhost ) server and it worked fine. You may have a permissions problem, or if you have a Windows server you may have to change the syntax for the explode characters, although I wrote it to work on Windows too. Also, I did not change the code you were using before, just added code to let you put the URL in easily.

    PS: Just added username/password fields to give some security. Change them to whatever you want.
    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    
    "http://www.w3.org/TR/html4/loose.dtd">
    
    <html>
    
    <head>
    
    <meta content="text/html; charset=utf-8" http-equiv="content-type">
    
    <script type="text/javascript">
    
    //Alerts to errors.
    
    window.onerror=function(msg, url, linenumber){var logerror='Error message: ' + msg + '. Url: ' + url + 'Line Number: ' + linenumber;alert(logerror);return false}
    
    </script>
    
        <title>Remote File Transfer</title>
    
    <style type="text/css">
    
    body
    
    {
    
    margin: 0 auto;
    
    width:900px;
    
    font-family:serif
    
    }
    
    #upload_box
    
    {
    
    background-color: LightBlue;
    
    border:1px solid Black;
    
    margin-top:40px;
    
    }
    
    </style>
    
    <?php
    
    if (isset($_POST['myupload']))
    
    {
    
    $user_name = $_POST['user'];
    
    $pass_word = $_POST['pass'];
    
    if ( $user_name=='justme' && $pass_word=='myself' )
    
    {
    
    $links_list = $_POST['upload'];
    
    $incr = 0;
    
    $links = explode("\r\n",$links_list);
    
    define('BUFSIZ', 4095);
    
    for ( $incr == 0 ; $incr < count($links) ; $incr++ )
    
    {
    
    $url = $links[$incr];
    
    $rfile = fopen($url, 'r');
    
    $lfile = fopen(basename($url), 'wb');
    
    while(!feof($rfile))
    
    fwrite($lfile, fread($rfile, BUFSIZ), BUFSIZ);
    
    fclose($rfile);
    
    fclose($lfile);
    
    }
    
    }
    
    }
    
    ?> 
    
    <script type="text/javascript"></script>
    
    </head>
    
    <body>
    
    <fieldset id="upload_box">
    
    <label>Remote File Transfer Form</label>
    
    <form action="" method="post">
    
    <input type="text" name="user" Value="Your Username">
    
    <input type="text" name="pass" Value="Your Password"><br>
    
    <textarea name="upload" cols=80 rows=20></textarea>
    
    <input type="submit" name="myupload" value="Transfer Files">
    
    </form>
    
    </fieldset>
    
    </body>
    
    </html>
    Last edited by DrDOS; 11-24-2010 at 01:32 AM.

  • #12
    New to the CF scene
    Join Date
    Jul 2012
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question

    Quote Originally Posted by DrDOS View Post
    I just tried it on remote ( non-localhost ) server and it worked fine. You may have a permissions problem, or if you have a Windows server you may have to change the syntax for the explode characters, although I wrote it to work on Windows too. Also, I did not change the code you were using before, just added code to let you put the URL in easily.

    PS: Just added username/password fields to give some security. Change them to whatever you want.
    Code:
    skipped to make the post smaller...
    hi, dear sir, i have used your code.. but i m facing some problem..

    your code works only for direct link files like:
    Code:
    http://www.example.com/sample.avi
    but if the source/url is a big and not direct link file then it will not work.. and create a very large error log file

    for example; following is an direct video link for youtube:
    Code:
    http://r13.par08s04.c.youtube.com/videoplayback?upn=EdIhJvNud8w&sparams=cp%2Cid%2Cip%2Cipbits%2Citag%2Cratebypass%2Csource%2Cupn%2Cexpire&fexp=916004%2C910102%2C913602%2C907217%2C907335%2C921602%2C919306%2C922600%2C919316%2C919804%2C920704%2C924500%2C906831%2C924700%2C913542%2C913547%2C919324%2C920706%2C924402%2C907344%2C912706%2C902518&ms=nxu&itag=22&ipbits=8&signature=01F92402966D1DEEC4FD40C75BD871B6B168415C.4616D705C13FD9E6C7B55AB50CCAC52A6B6D2FC5&sver=3&mt=1342524127&ratebypass=yes&source=youtube&expire=1342548842&key=yt1&ip=180.211.196.203&cp=U0hTR1VPVl9JTENOM19NSVpJOnZrZElkY2d5MTU0&id=a8910422c69c2ecc&redirect_counter=1&cms_redirect=yes&st=nx&ir=1
    i use internet download manager and it generate that direct link form most of the video sites, and i need to download videos/file form those link by using your php scripts..

    but it don't work for that kind of link..

    i even try to change :
    from:
    Code:
    $lfile = fopen(basename($url), 'wb');
    to:
    Code:
    $lfile = fopen('yt.flv', 'wb');
    but still it don't work..

    so, if you can give me an idea/solution then it would be great

    please sir, leave a reply asap

    best regards


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •