P2M Posted March 26, 2007 Share Posted March 26, 2007 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: [email protected]"; $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" . "[email protected]"; @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 [email protected] Link to comment https://forums.phpfreaks.com/topic/44383-php-upload-form/ Share on other sites More sharing options...
Hell Toupee Posted March 26, 2007 Share Posted March 26, 2007 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: [email protected]"; $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" . "[email protected]"; @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 https://forums.phpfreaks.com/topic/44383-php-upload-form/#findComment-215563 Share on other sites More sharing options...
P2M Posted March 26, 2007 Author Share Posted March 26, 2007 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 https://forums.phpfreaks.com/topic/44383-php-upload-form/#findComment-215568 Share on other sites More sharing options...
RickHope Posted March 28, 2007 Share Posted March 28, 2007 Bump! Link to comment https://forums.phpfreaks.com/topic/44383-php-upload-form/#findComment-216625 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.