Jump to content

PHP Upload Form


P2M

Recommended Posts

Hi i aprichate your time, well straight to the point

 

I have this script below which i edited mostly my self.

But what i want doing i have no knowledge about hope you do

 

I need:

1. The song being uploaded to be renamed if the same one already exists, or just when uploaded to be arandomised name.

2. I would like if possible for it not to be emailed to people but the code just to appear on a seprate page when uploaded succesfully.

 

 

Here is the code:

 

<?php

include("header.html");

@$Name = addslashes($_POST['Name']);

@$email = addslashes($_POST['email']);

@$music_code = "<embed style=\"FILTER: xray\" name=\"RAOCXplayer1\" width=\"310\" height=\"43\" src=\"\" ShowStatusBar=false autostart=false ShowStatusBar=false ShowControls=true Cache=True loop=\"false\" type='application/x-mplayer2' volume=\"60\">\n";

@$upload_Name = $_FILES['upload']['name'];

@$upload_Size = $_FILES['upload']['size'];

@$upload_Temp = $_FILES['upload']['tmp_name'];

@$upload_Mime_Type = $_FILES['upload']['type'];

 

function RecursiveMkdir($path)

{

  if (!file_exists($path))

  {

      RecursiveMkdir(dirname($path));

      mkdir($path, 0777);

    }

  }

 

 

 

if (! ereg('[A-Za-z0-9_-]+\@[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+', $email))

{

die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid email</font></p>");

}

 

if( $upload_Size == 0)

{

die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid upload</font></p>");

}

// CHANGE FILE SIZE LIMIT HIGHER OR LOWER - SET AT 2megs -  - REMEMBER HOSTING LIMITS

if( $upload_Size >15000000)

// -------------

{

 

unlink($upload_Temp);

die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid upload</font></p>");

}

if( $upload_Mime_Type != "audio/32kadpcm" AND $upload_Mime_Type != "audio/basic" AND $upload_Mime_Type != "audio/DAT12" AND $upload_Mime_Type != "audio/G.722.1" AND $upload_Mime_Type != "audio/L16" AND $upload_Mime_Type != "audio/L20" AND

$upload_Mime_Type != "audio/x-ms-wma" AND $upload_Mime_Type != "audio/x-wav" AND $upload_Mime_Type != "audio/wav" AND

$upload_Mime_Type != "audio/L24" AND $upload_Mime_Type != "audio/MP4A-LATM" AND $upload_Mime_Type != "audio/mpa-robust" AND $upload_Mime_Type != "audio/mpeg" AND $upload_Mime_Type != "audio/parityfec" AND $upload_Mime_Type != "audio/prs.sid" AND $upload_Mime_Type != "audio/telephone-event" AND $upload_Mime_Type != "audio/tone" AND $upload_Mime_Type != "audio/vnd.cisco.nse" AND $upload_Mime_Type != "audio/vnd.cns.anp1" AND $upload_Mime_Type != "audio/vnd.cns.inf1" AND $upload_Mime_Type != "audio/vnd.digital-winds" AND $upload_Mime_Type != "audio/vnd.everad.plj" AND $upload_Mime_Type != "audio/vnd.lucent.voice" AND $upload_Mime_Type != "audio/vnd.nortel.vbk" AND $upload_Mime_Type != "audio/vnd.nuera.ecelp4800" AND $upload_Mime_Type != "audio/vnd.nuera.ecelp7470" AND $upload_Mime_Type != "audio/vnd.nuera.ecelp9600" AND $upload_Mime_Type != "audio/vnd.octel.sbc" AND $upload_Mime_Type != "audio/vnd.qcelp" AND $upload_Mime_Type != "audio/vnd.rhetorex.32kadpcm" AND $upload_Mime_Type != "audio/vnd.vmx.cvsd" )

{

unlink($upload_Temp);

die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid upload</font></p>");

}

$uploadFile = "uploads/".$upload_Name ;

if (!is_dir(dirname($uploadFile)))

  {

    @RecursiveMkdir(dirname($uploadFile));

  }

else

  {

  @chmod(dirname($uploadFile), 0777);

  }

@move_uploaded_file( $upload_Temp , $uploadFile);

chmod($uploadFile, 0644);

 

//CHANGE THIS TO THE YOUR DOMAIN

$upload_URL = "http://www.playin2much.co.uk/uploads/uploads/".$upload_Name ;

//------------

 

$pfw_header = "From: RickHope@Playin2much.co.uk";

$pfw_subject = "Your Music Code - Uploaded @ Playin2much.co.uk";

 

// CHANGE THIS TO YOUR EMAIL ADDRESS

$pfw_email_to = "$email";

//------------

 

$pfw_message = "Song Name: $Name\n"

. "Your Email: $email\n"

. "Upload URL: $upload_URL\n\n\n"

. "Copy all the code below and paste it into your webpage's HTML box.\n\n\n"

. "<table border=\"0\" width=\"287\"><tr><td width=\"281\"><embed style=\"FILTER: xray\" name=\"RAOCXplayer1\" width=\"310\" height=\"43\" src=\"$upload_URL\" autostart=true ShowStatusBar=false ShowControls=true Cache=True loop=\"true\" type='application/x-mplayer2' volume=\"65\"><a href=\"http://www.playin2much.co.uk/index.html\"><img border=\"0\" src=\"http://www.playin2much.co.uk/images/Image8.gif\" width=\"310\" height=\"22\"></a></div></tr></table>\n\n\n\n\n"

. "Thanks Rick Hope, Owner of Playin2much.co.uk"

. "RickHope@Playin2much.co.uk";

@mail($pfw_email_to, $pfw_subject ,$pfw_message ,$pfw_header ) ;

 

echo("<p align='center'><font face='Arial' size='3' color='#FFFFFF'>Your audio file has been uploaded, Please check your email & junk email folder, Press back to upload another.</font></p>");

include("footer.html");

?>

 

 

thanks for your time

Richard

RickHope@Playin2much.co.uk  ;)

Link to comment
Share on other sites

First off, get rid of all the @'s when devloping stuff.

 

To make the file random:

 

$upload_Name =md5(time().$upload_Temp);

 

I dunno what you mean by the second part, if you don't want it to email people, just remove this bit of code:

 

//CHANGE THIS TO THE YOUR DOMAIN
$upload_URL = "http://www.playin2much.co.uk/uploads/uploads/".$upload_Name ;
//------------

$pfw_header = "From: RickHope@Playin2much.co.uk";
$pfw_subject = "Your Music Code - Uploaded @ Playin2much.co.uk";

// CHANGE THIS TO YOUR EMAIL ADDRESS
$pfw_email_to = "$email";
//------------

$pfw_message = "Song Name: $Name\n"
. "Your Email: $email\n"
. "Upload URL: $upload_URL\n\n\n"
. "Copy all the code below and paste it into your webpage's HTML box.\n\n\n"
. "<table border=\"0\" width=\"287\"><tr><td width=\"281\"><embed style=\"FILTER: xray\" name=\"RAOCXplayer1\" width=\"310\" height=\"43\" src=\"$upload_URL\" autostart=true ShowStatusBar=false ShowControls=true Cache=True loop=\"true\" type='application/x-mplayer2' volume=\"65\"><a href=\"http://www.playin2much.co.uk/index.html\"><img border=\"0\" src=\"http://www.playin2much.co.uk/images/Image8.gif\" width=\"310\" height=\"22\">[/url]</div></tr></table>\n\n\n\n\n"
. "Thanks Rick Hope, Owner of Playin2much.co.uk"
. "RickHope@Playin2much.co.uk";
@mail($pfw_email_to, $pfw_subject ,$pfw_message ,$pfw_header ) ;

 

And what code do you want to appear on the next page?

Link to comment
Share on other sites

thanks

 

where do i place this?

 

$upload_Name =md5(time().$upload_Temp);

 

i want this to appear on the next page

 

. "Copy all the code below and paste it into your webpage's HTML box.\n\n\n"

. "<table border=\"0\" width=\"287\"><tr><td width=\"281\"><embed style=\"FILTER: xray\" name=\"RAOCXplayer1\" width=\"310\" height=\"43\" src=\"$upload_URL\" autostart=true ShowStatusBar=false ShowControls=true Cache=True loop=\"true\" type='application/x-mplayer2' volume=\"65\"><a href=\"http://www.playin2much.co.uk/index.html\"><img border=\"0\" src=\"http://www.playin2much.co.uk/images/Image8.gif\" width=\"310\" height=\"22\">[/url]</div></tr></table>\n\n\n\n\n"

 

 

thanks for your help

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.