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 4 of 4

Thread: Script problem

  1. #1
    New Coder
    Join Date
    Sep 2007
    Location
    US
    Posts
    88
    Thanks
    4
    Thanked 4 Times in 4 Posts

    Script problem

    I've yet again found a problem with my script. the script bellow is set to allow processions if the mime type of a file is equal to a .mp3 or a .wav file but no matter how a change it I still throws my set error and stops the process.

    PHP Code:
    $mp3 = array( 'audio/x-mpegurl''audio/mpeg3''audio/x-mpeg-3''audio/x-mpeg')
    if(
    $_SESSION['permix']['a_podz'] == 1)
    {    
        if (
    $podz->validate()) 
        {
            
    $podz->freeze();
            
            if(isset(
    $_POST['pid']))
            {
                
    $podz->process('podz_rocessing'false);
            }
            
            if (isset(
    $_GET['sub']) && $_GET['sub'] == 'upload' and !isset($_POST['pid'])) 
            {   
                
    // Uploading/Resizing Script
                
                
    $ext explode('.'basename($_FILES['pod_file']['name']));   // Get The File Extention In The Format Of , For Instance, .jpg, .gif or .php
                
    $file_ext '.'.$ext[1];
                
    $url $_FILES['pod_file']['name'];   // Set $url To Equal The Filename For Later Use
                
    if($_FILES['pod_file']['type'] == $mp3 || $_FILES['pod_file']['type'] == 'audio/x-wav')
                {
                    
    $copy copy($_FILES['pod_file']['tmp_name'], "$pdir" $new_name $file_ext);   // Move Image From Temporary Location To Permanent Location
                    
    if($copy)
                    {   
    // If The Script Was Able To Copy The Image To It's Permanent Location
                        
    $podz->process('podz_processing'false);
                        
    $link "$pdir" $new_name $file_ext;
                    }
                    else
                    {
                        echo
    'Your podcast did not go through. Tell CTB that it wasn\'t copied';
                    }
                }
                else
                {    
                    print 
    '<font color="#FF0000">ERROR: Wrong filetype (has to be a .wav or .mp3. Yours is ';   // Error Message If Filetype Is Wrong
                    
    print $file_ext;   // Show The Invalid File's Extention
                    
    print '.</font>';
                }
            }
        }
        else
        {
            
    define('PAGE_TITLE''ACP - Podcasts');
            
    define('BODY_FORM','width="1000" cellpadding="0" cellspacing="0" height="1" bordercolor="#000000" style="main" border="0"');
            include_once(
    'includes/Header.php');
            include_once(
    'includes/Hmessage.php');
            
    $podz->display();
            include_once(
    'includes/Fmessage.php');
            include_once(
    'includes/footer.php');
        }

    can any one help me out on this one?
    thanks.
    I need to find a book about all this stuff. God, thats gonna be one big book!

    http://www.gamezftw.com
    Play On!

  • #2
    Regular Coder
    Join Date
    May 2006
    Location
    Wales
    Posts
    820
    Thanks
    1
    Thanked 82 Times in 79 Posts
    $_FILES['pod_file']['type'] == $mp3
    You'll need to use in_array()

    PHP Code:
    if(in_array($_FILES['pod_file']['type'], $mp3)) 

  • #3
    New Coder
    Join Date
    Sep 2007
    Location
    US
    Posts
    88
    Thanks
    4
    Thanked 4 Times in 4 Posts
    That didn't work. The script is still giving me an error the the file type doesn't match .mp3 or.wav but whats better is that it tell me the file type is .mp3!

    I do not get this at all. Whats wrong with the statement?
    I need to find a book about all this stuff. God, thats gonna be one big book!

    http://www.gamezftw.com
    Play On!

  • #4
    New Coder
    Join Date
    Sep 2007
    Location
    US
    Posts
    88
    Thanks
    4
    Thanked 4 Times in 4 Posts
    Well okay. I've got it to upload my files, but now i have two other problems.
    One.) It redirects the user to the sites base URL with the name of the file attached to it.
    Two.) It creates the file with the extension but the file has no data in it at all.

    How do I actually get it to upload my file?
    I need to find a book about all this stuff. God, thats gonna be one big book!

    http://www.gamezftw.com
    Play On!


  •  

    Posting Permissions

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