Mp3 upload

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Terriator
Forum Commoner
Posts: 60
Joined: Mon Jul 04, 2005 12:46 pm

Mp3 upload

Post by Terriator »

Hey,I was trying to make a script so that I could upload mp3's to the server...This is basically what I've got so far:

Code: Select all

if($_GET['page']==upload){
  echo"<center><h1>Upload Musik</h1><br>
  <FORM ACTION='features.php?page=upload_now' METHOD='POST' enctype='multipart/form-data'>
  <b>Navn på nummer: </b><INPUT TYPE='TEXT' NAME='headline' size='20' /><br><br>
  <b>Find filen: </b><input type='file' name='file'><br><br>
  <input TYPE='submit' VALUE='Upload'/>
  </FORM>
  </center>";
}

//Do upload file
if($_GET['page']==upload_now){
  //Target path
  $target_path = "musik/";
  //Upload
  $filename = $_FILES['file']['name'];
  $temp = $_FILES['file']['tmp_name'];

  copy($_FILES['file']['tmp_name'], '../musik/'.$_FILES['file']['name']) or die ('Could not upload');

  echo"<center><br><b><u>Musikfilen er oploadet</u></b><br><a href='index.php?page=index'>Klik her for at tilbage til administratormodulet</a><br><br></center>";
}
It works fine with pictures and stuff, but I can't upload other files such as musik?
User avatar
shiznatix
DevNet Master
Posts: 2745
Joined: Tue Dec 28, 2004 5:57 pm
Location: Tallinn, Estonia
Contact:

Post by shiznatix »

<input type="hidden" name="MAX_FILE_SIZE" value="9999999999999999">

replace the 9's in the value with the max amount of bytes that you want allowed to be uploaded
Liquidant
Forum Newbie
Posts: 3
Joined: Mon Feb 20, 2006 11:21 am

Post by Liquidant »

could that be changed to set the max bit rate instead.

I need to check that the bit rate is 128kbps or below before I allow anyone to upload
User avatar
nickman013
Forum Regular
Posts: 764
Joined: Sun Aug 14, 2005 12:02 am
Location: Long Island, New York

Post by nickman013 »

You can try these.

:arrow: http://ffmpeg-php.sourceforge.net/
:arrow: http://www.bloodys.com/phpscripts.php

Thats if you want to use someone elses scripts though.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Nope. You will have to process the file once it is uploaded.

and ooooold thread.
Post Reply