Advanced URL upload

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Advanced URL upload

    Hy !!!
    using url upload is it possible to make the file to be placed on our desired directory?

    like

    when we do url upload

    make the file to be uploaded on this folder

    /games/symbian


    another example

    instead of getting the file on the same folder where the url uploader script is present
    if iam running the urluploader script in "UPLOAD" folder (for example)

    can i make it get uploaded in videos folder ( i mean the uploaded file )
    i hope you can understand what i am trying to say !!

    One more thing !! there are scripts which will make them to get uploaded like the way i described
    i want mp4 files to be uploaded on
    videos/mp4

    and 3gp files to be uploaded on
    videos/3gp


    [ sorry for bad english]
    Last edited by KingofKingZ; 26.04.12, 03:05.

    #2
    here

    PHP Code:
    <?php

    if($_POST["submit"]){
    $url trim($_POST["url"]);
    if(
    $url){
    $file fopen($url,"rb");
    if(
    $file){
    $filename strtolower($file) ; 
     
    $exts split("[/\\.]"$filename) ; 
     
    $n count($exts)-1
     
    $exts $exts[$n]; 
     return 
    $exts
     if(
    $exts=="mp4"){
    $directory "videos/mp4";
    }
    if(
    $exts=="3gp"){
    $directory "videos/3gp";
    }else{
    $directory "./downloads";
    }

    $valid_exts = array("jpg","jpeg","gif","png","mp4","3gp"); 
    $ext end(explode(".",strtolower(basename($url))));
    if(
    in_array($ext,$valid_exts)){
    $rand rand(10000,99999);
    $filename $rand basename($url);
    $newfile fopen($directory $filename"wb"); 
    if(
    $newfile){
    while(!
    feof($file)){
    // Write the url file to the directory.
    fwrite($newfile,fread($file,1024 8),1024 8);
    }
    echo 
    'File uploaded successfully! You can access the file here:'."\n";
    echo 
    ''.$directory.$filename.'';
    } else { echo 
    'Could not establish new file ('.$directory.$filename.') on local server. Be sure to CHMOD your directory to 777.'; }
    } else { echo 
    'Invalid file type. Please try another file.'; }
    } else { echo 
    'Could not locate the file: '.$url.''; }
    } else { echo 
    'Invalid URL entered. Please try again.'; }
    }
    ?>
    edited to suit request

    you will need to add more checks also this is completety unchecked so u will have to fix errors and what not
    Last edited by Loony; 26.04.12, 03:18.
    Creator of
    Epix.Mobi

    Keep an Eye on us Big things coming soon!!!!
    Need something for your site hit me up here

    http://coding-talk.com/forum/main-fo...r-your-wapsite

    Comment


      #3
      should i just run it or what? when i ran it nothing happened !!! can u pls tell me where should i upload this script? should i make a new folder for this in public_html and what is the chmod for this?

      Comment


        #4
        .

        u need to submit a url to this page it will get the url and check the file contents
        Creator of
        Epix.Mobi

        Keep an Eye on us Big things coming soon!!!!
        Need something for your site hit me up here

        http://coding-talk.com/forum/main-fo...r-your-wapsite

        Comment


          #5
          hey can u make it as user friendly?

          Comment


            #6
            ok

            1. create a folder called upload
            2. create a file in that folder called index.php
            3.copy your sites headers and footers and add
            PHP Code:
            <form action="upload.php" method="post">
            Enter URL: <input type="text" name="url" size="35" /> <input type="submit" value="Submit" name="submit" />
            </
            form
            to the index.php file

            4.create a file called upload.php
            5.copy your sites headers and footers and add
            PHP Code:
            <?php 

            if($_POST["submit"]){ 
            $url trim($_POST["url"]); 
            if(
            $url){ 
            $file fopen($url,"rb"); 
            if(
            $file){ 
            $filename strtolower($file) ;  
             
            $exts split("[/\\.]"$filename) ;  
             
            $n count($exts)-1;  
             
            $exts $exts[$n];  
             return 
            $exts;  
             if(
            $exts=="mp4"){ 
            $directory "videos/mp4"

            if(
            $exts=="3gp"){ 
            $directory "videos/3gp"
            }else{ 
            $directory "downloads"


            $valid_exts = array("jpg","jpeg","gif","png","mp4","3gp");  
            $ext end(explode(".",strtolower(basename($url)))); 
            if(
            in_array($ext,$valid_exts)){ 
            $rand rand(10000,99999); 
            $filename $rand basename($url); 
            $newfile fopen($directory $filename"wb");  
            if(
            $newfile){ 
            while(!
            feof($file)){ 
            // Write the url file to the directory. 
            fwrite($newfile,fread($file,1024 8),1024 8); 

            echo 
            'File uploaded successfully! You can access the file here:'."\n"
            echo 
            ''.$directory.$filename.''
            } else { echo 
            'Could not establish new file ('.$directory.$filename.') on local server. Be sure to CHMOD your directory to 777.'; } 
            } else { echo 
            'Invalid file type. Please try another file.'; } 
            } else { echo 
            'Could not locate the file: '.$url.''; } 
            } else { echo 
            'Invalid URL entered. Please try again.'; } 

            ?>
            to your upload.php file

            6. create 2 folders called downloads and 1 videos
            7. chmod those 2 folders to 777
            8. inside the videos folder create 2 more folders 1 called mp4 and the other called 3gp
            9.chmod those 2 folders to 777

            then the rest is up to you mate ive almost done it all for you anyway
            Creator of
            Epix.Mobi

            Keep an Eye on us Big things coming soon!!!!
            Need something for your site hit me up here

            http://coding-talk.com/forum/main-fo...r-your-wapsite

            Comment


              #7
              Thank Loony mate, this will help alot. Thanks for the codes.

              Comment


                #8
                Thanks a lot.
                Great to find this post!!

                Comment

                Working...
                X