...

View Full Version : Script problem



Digicoder
11-18-2007, 03:58 AM
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.


$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.

Mwnciau
11-18-2007, 04:24 AM
$_FILES['pod_file']['type'] == $mp3

You'll need to use in_array()


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

Digicoder
11-18-2007, 04:38 AM
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?

Digicoder
11-18-2007, 07:15 AM
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?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum