alifcintaibu

tanya_error_multi_file

May 19th, 2012
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.82 KB | None | 0 0
  1. <?php ?>
  2. <html>
  3. <head>
  4.    <title>Multiple File Upload</title>
  5.    <script type="text/javascript">
  6.  
  7.    function show()
  8.         {
  9.             var n = document.myform.jumfile.value;
  10.             var i;
  11.             var string = "";
  12.  
  13.             for (i=0; i<=n-1; i++)
  14.             {
  15.                string = string + "Pilih File: <input name=\"userfile"+ i + "\" type=\"file\"><br>";
  16.             }
  17.  
  18.             document.getElementById('selectfile').innerHTML = string;
  19.             document.myform.n.value = n;
  20.         }
  21.     </script>
  22. </head>
  23. </html>
  24. <?php
  25. include 'index2.php';
  26. include 'fungsi_editanq.php';
  27. $con = mysql_connect("localhost","root","");
  28. if (!$con) {
  29. die('Koneksi ke database gagal: ' . mysql_error());
  30. }
  31. mysql_select_db("uji1", $con);
  32. mysql_query("truncate table `tbberita`");
  33. mysql_query("truncate table `tbkeyword`");
  34. mysql_query("truncate table `tbstem`");
  35. mysql_query("truncate table `tbtoken`");
  36.  
  37. echo "<form name='myform' enctype='multipart/form-data' method='POST'>
  38.        Pilih Jumlah File
  39.        <select name='jumfile' onchange='show()'>
  40.            <option value='1'>1</option>
  41.            <option value='2'>2</option>
  42.            <option value='3'>3</option>
  43.            <option value='4'>4</option>
  44.            <option value='5'>5</option>
  45.            <option value='6'>6</option>
  46.        </select>
  47.        <br><br>
  48.        <input type='hidden' name='MAX_FILE_SIZE' value='20000000' />
  49.        <div id='selectfile'>
  50.        </div>
  51.    <br>
  52.    <input type='hidden' name='n' />
  53.   <INPUT TYPE=SUBMIT VALUE='Stem!' name ='submit'>
  54.    </form>";
  55.  
  56. if(isset($_POST['submit'])){
  57. for ($i=0; $i<=$n-1; $i++){
  58.   $string = file_get_contents ($_FILES['userfile'.$i]['tmp_name']);    
  59.     stemming2($string);//tidak dapat mengeksekusi fungsi stemming2,kenapa ya???padahal sudah saya looping
  60.     }
  61. }
Advertisement
Add Comment
Please, Sign In to add comment