note 75639 added to function.move-uploaded-file

From: Date: Sat, 09 Jun 2007 20:53:34 +0000
Subject: note 75639 added to function.move-uploaded-file
Groups: php.notes 
Request: Send a blank email to php-notes+get-127338@lists.php.net to get a copy of this message
Hi guys this is my 1st post here. Trying to upload up to 8 images at once i spent some time figuring out how to do it. So if anyone will need how I handled that issue here it is: <?php $someuniq = date("Hms"); /// INSERT whatever text fields you have there: $imprd="INSERT INTO somegallery (gtitle, guniq, etc) VALUES ('$gtitle', '$someuniq ', '$etc')"; if (!mysql_query($imprd)) {echo mysql_error();} //// UPDATE SQL with image name so you can output in HTML when you need //number 8 = how many img fileds, each img field is img0,img1...etc //$fullpath = 'somefolder/'; for($i = 0; $i < 8; $i++) { $tmp_name = $_FILES["img".$i]["tmp_name"]; $new_name = $_FILES["img".$i]["name"]; $clean_name = ereg_replace("[^a-z0-9._]", "", str_replace(" ", "_", str_replace("%20", "_", strtolower($new_name) ) ) ); move_uploaded_file($tmp_name,$fullpath . $clean_name); $imgz= "img".$i; if (strlen($clean_name) > 2) { $imep3="UPDATE somegallery SET $imgz = '$clean_name' WHERE someuniq = '$someuniq'"; if (!mysql_query($imep3)) {echo mysql_error();} } } ?> ---- Server IP: 193.95.141.37 Probable Submitter: 86.40.98.2 ---- Manual Page -- http://www.php.net/manual/en/function.move-uploaded-file.php Edit -- https://master.php.net/note/edit/75639 Del: integrated -- https://master.php.net/note/delete/75639/integrated Del: useless -- https://master.php.net/note/delete/75639/useless Del: bad code -- https://master.php.net/note/delete/75639/bad+code Del: spam -- https://master.php.net/note/delete/75639/spam Del: non-english -- https://master.php.net/note/delete/75639/non-english Del: in docs -- https://master.php.net/note/delete/75639/in+docs Del: other reasons-- https://master.php.net/note/delete/75639 Reject -- https://master.php.net/note/reject/75639 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#127338) next »