ciauz!!
ho trovato questo script su internet, ma siccome era tutto attacato, ho dovuto darli una sitemata.
ora non so se a causa mia o per è scritto male non va.
potreste darmi un occhiata?
inoltre visto che esegue un comando exec potete darmi qualche dritta??
Codice PHP:
<?php ini_set( "max_execution_time", "3600" ); // sets the maximum execution time of this script to 1 hour.
$fileName = $_FILES['message']['name']; // get client side file name
if( $fileName ) { // Check File Type
$fileNameParts = explode( ".", $fileName ); // seperate the name from the ext
$fileExtension = end( $fileNameParts ); // part behind last dot
$fileExtension = strtolower( $fileExtension ); // reduce to lower case
if( !$fileExtension == "mp3" ) { die( "$fileName is not an mp3 file." ); } // Check File Size
$fileSize = $_FILES['message']['size']; // size of uploaded file
if( $fileSize == 0 ) { die( "Sorry. The upload of $fileName has failed. The file size is 0." ); } else if( $fileSize > 10240000 ) { //10 MB
die( "Sorry. The file $fileName is larger than 10MB. Advice: reduce the file quality and upload again." ); } else { $uploadDir = '/var/www/vhosts/yourdomain.com/httpdocs/audio/audio_to_encode/'; // Where the temp file will go
$uploadFile = str_replace( " ", "", $uploadDir . $_FILES['message']['name'] ); // Get rid of spaces in the filename
$finalDir = '/var/www/vhosts/yourdomain.com/httpdocs/audio/flv_files/'; // Where the final file will go
$finalFile = str_replace( " ", "", $finalDir . $fileNameParts[0] . ".flv" ); // Get rid of spaces in the filename
if ( !move_uploaded_file( $_FILES['message']['tmp_name'], $uploadFile ) ) { echo "Possible file upload attack! Here's some debugging info:\n"; echo( $_FILES ); } $encode_cmd = "/usr/bin/ffmpeg -i $uploadFile -f flv -acodec mp3 -ab 64 -ac 1 -title \"Clip Title\" -author \"Clip Author\" -copyright \"Clip Copyright\" $finalFile"; exec( $encode_cmd ); unlink( $uploadFile ); chmod( $finalFile, 0644 ); } } ?>