note 106482 added to function.move-uploaded-file

From: Date: Sun, 13 Nov 2011 11:15:36 +0000
Subject: note 106482 added to function.move-uploaded-file
Groups: php.notes 
Request: Send a blank email to php-notes+get-184412@lists.php.net to get a copy of this message
i'm newbie in php 5...i have build application with php n mysql... this my problem 1. $op=$_GET['op']; (Undefined index) 2. upload.php, this is the code <?php // setting nama folder tempat upload $uploaddir = 'data/'; // undefined index $fileName = $_FILES['userfile']['name']; // undefined index $tmpName = $_FILES['userfile']['tmp_name']; // undefined index $fileSize = $_FILES['userfile']['size']; // undefined index $fileType = $_FILES['userfile']['type']; // koneksi ke mysql mysql_connect('localhost','root','hagapurnama'); mysql_select_db('perpustakaanarsip'); // menyimpan properti atau informasi file ke tabel upload dalam db // dengan terlebih dahulu mengecek ada tidaknya nama file dalam tabel $query = "SELECT count(*) as jum FROM upload WHERE name = '$fileName'"; $hasil = mysql_query($query); $data = mysql_fetch_array($hasil); if ($data['jum'] > 0) { $query = "UPDATE upload SET size = '$fileSize' WHERE name = '$fileName'"; } else $query = "INSERT INTO upload (name, size, type) VALUES ('$fileName', '$fileSize', '$fileType')"; mysql_query($query); // menggabungkan nama folder dan nama file $uploadfile = $uploaddir . $fileName; // proses upload file ke folder 'data' if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) { ?><script language="JavaScript">alert('Penambahan Ebook Berhasil !!'); document.location='edokumen.php'</script><? } else { ?><script language="JavaScript">alert('GAGAL Menambah Koleksi Ebook !!'); document.location='edokumen.php'</script><? } ?> please kind to help me with that proble (undefined index) regards ---- Server IP: 202.158.52.162 Probable Submitter: 112.215.66.14 ---- Manual Page -- http://www.php.net/manual/en/function.move-uploaded-file.php Edit -- https://master.php.net/note/edit/106482 Del: integrated -- https://master.php.net/note/delete/106482/integrated Del: useless -- https://master.php.net/note/delete/106482/useless Del: bad code -- https://master.php.net/note/delete/106482/bad+code Del: spam -- https://master.php.net/note/delete/106482/spam Del: non-english -- https://master.php.net/note/delete/106482/non-english Del: in docs -- https://master.php.net/note/delete/106482/in+docs Del: other reasons-- https://master.php.net/note/delete/106482 Reject -- https://master.php.net/note/reject/106482 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#184412) next »