Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include 'index2.php';
- include 'fungsi_editanq.php';
- $con = mysql_connect("localhost","root","");
- if (!$con) {
- die('Koneksi ke database gagal: ' . mysql_error());
- }
- mysql_select_db("uji1", $con);
- mysql_query("truncate table `tbberita`");
- mysql_query("truncate table `tbkeyword`");
- mysql_query("truncate table `tbstem`");
- mysql_query("truncate table `tbtoken`");
- if(isset($_POST)){
- $n=count($_FILES['userfile']['name']);
- //print_r($_FILES);
- for ($i=0; $i<=$n-1; $i++){
- /*
- $string = file_get_contents ($_FILES['userfile'.$i]['tmp_name']);
- stemming2($string);
- tidak dapat mengeksekusi fungsi stemming2,kenapa ya???
- padahal sudah saya looping
- */
- //echo '<pre>';print_r($_FILES['userfile']['tmp_name'][$i]);
- //echo '</pre>';
- $string = file_get_contents ($_FILES['userfile']['tmp_name'][$i]);
- stemming2($string);
- }
- }
- ?>
- <html>
- <head>
- <title>Multiple File Upload</title>
- <script type="text/javascript">
- function show()
- {
- var n = document.myform.jumfile.value;
- var i;
- var string = "";
- for (i=0; i<=n-1; i++)
- {
- string = string + "Pilih File: <input name=\"userfile[]\" type='file'><br>";
- }
- document.getElementById('selectfile').innerHTML = string;
- document.myform.n.value = n;
- }
- </script>
- </head>
- <body>
- <?php
- echo "<form name='myform' enctype='multipart/form-data' method='POST'>
- Pilih Jumlah File
- <select name='jumfile' onchange='show()'>
- <option >Pilih dari jumlah dibawah</option>
- <option value='1'>1</option>
- <option value='2'>2</option>
- <option value='3'>3</option>
- <option value='4'>4</option>
- <option value='5'>5</option>
- <option value='6'>6</option>
- </select>
- <br><br>
- <input type='hidden' name='MAX_FILE_SIZE' value='20000000' />
- <div id='selectfile'>
- </div>
- <br>
- <input type='hidden' name='n' value='1' />
- <INPUT TYPE=SUBMIT VALUE='Stem!' name ='submit'>
- </form>";
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement