<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[script per upload e exec]]></title><description><![CDATA[<p dir="auto">ciao ragazzi.</p>
<p dir="auto">potete verificare questo script??</p>
<p dir="auto">inoltre vsito che devo eseguire un commando exec, potete darmi qualche dritta?</p>
<pre><code>&lt;?php 
$fileName = $_FILES['audio']['name']; // get client side file name if( $fileName )
 
   // Check File Size
    $fileSize = $_FILES['audio']['size']; // size of uploaded file
  if( $fileSize == 0 ) { die( "Sorry. The upload of $fileName has failed. The file size is 0." ); } else if( $fileSize &gt; 1024000 ) { //10 MB 
  die( "Sorry. The file $fileName is larger than 10MB. Advice: reduce the file quality and upload again." ); } else { $uploadDir = '/var/www/vhosts/sito/subdomains/member/httpdocs/upload/to_encode/'; 
  // Where the temp file will go
   $uploadFile = str_replace( " ", "", $uploadDir . $_FILES['audio']['name'] ); // Get rid of spaces in the filename 
   $finalDir = '/var/www/vhosts/sito/subdomains/member/httpdocs/upload/encoded/'; // 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['audio']['tmp_name'], $uploadFile ) ) { echo "Possible file upload attack! Here's some debugging info:\n"; echo( $_FILES ); } $encode_cmd = "/usr/local/bin/ffmpeg -i $uploadFile -f flv -acodec mp3 -ab 64 -ac 1 -ar 22050 -s 470x320 -title \"xxxx\" -author \"xxxx\" -copyright \"Copyright xxxx\" $finalFile"; 
    exec( $encode_cmd ); 
    unlink( $uploadFile ); 
    chmod( $finalFile, 0777 ); } } ?&gt;
</code></pre>
]]></description><link>https://dev.connect.gt/topic/40075/script-per-upload-e-exec</link><generator>RSS for Node</generator><lastBuildDate>Thu, 26 Nov 2026 05:19:36 GMT</lastBuildDate><atom:link href="https://dev.connect.gt/topic/40075.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 05 Jul 2007 17:27:35 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to script per upload e exec on Fri, 06 Jul 2007 16:16:56 GMT]]></title><description><![CDATA[<p dir="auto">risposto il codice più ordinato.</p>
<p dir="auto">siccome non riesco a covertire i file devo eslcudere che sia er colpa del codice. avrei bisogno che qualche esperto mi dicesse che il codice è ok</p>
<pre><code>&lt;?php 
ini_set( "max_execution_time", "3600" ); // sets the maximum execution time of this script to 1 hour. 
$fileName = $_FILES['miofile']['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 != "avi" AND $fileExtension != "mpeg" AND $fileExtension != "asf" ) { die( "&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;div align=\"center\" style=\"font-family:verdana,arial;\"&gt;Non puoi caricare questo tipo di file.&lt;br&gt; I file ammessi sono &lt;strong&gt;.avi .mpeg .asf&lt;/strong&gt;&lt;/div&gt;" ); } // Check File Size
  $fileSize = $_FILES['miofile']['size']; // size of uploaded file 
  if( $fileSize == 0 ) { die( "Sorry. The upload of $fileName has failed. The file size is 0." ); } else if( $fileSize &gt; 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/sito/subdomains/member/httpdocs/upload/to_encode/'; // Where the temp file will go 
   $uploadFile = str_replace( " ", "", $uploadDir . $_FILES['miofile']['name'] ); // Get rid of spaces in the filename 
   $finalDir = '/var/www/vhosts/sito/subdomains/member/httpdocs/upload/encoded/'; // 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['miofile']['tmp_name'], $finalFile ) )
    $encode_cmd = "/usr/local/bin/ffmpeg -i $uploadFile -f flv -acodec mp3 -ab 64 -ac 1 -ar 22050  $finalFile"; 
 
     exec( $encode_cmd ); 
     unlink( $uploadFile ); 
     chmod( $finalFile, 0644 ); } } 
  
   { header("location: [URL]http://www.google.com[/URL]") ; }
  ?&gt;
</code></pre>
]]></description><link>https://dev.connect.gt/post/563733</link><guid isPermaLink="true">https://dev.connect.gt/post/563733</guid><dc:creator><![CDATA[fre2004]]></dc:creator><pubDate>Fri, 06 Jul 2007 16:16:56 GMT</pubDate></item></channel></rss>