note 130046 added to function.move-uploaded-file

From: Date: Thu, 20 Feb 2025 16:01:08 +0000
Subject: note 130046 added to function.move-uploaded-file
Groups: php.notes 
Request: Send a blank email to php-notes+get-221870@lists.php.net to get a copy of this message
<?php //upload mutliple image paths stored as a variable array //$_SESSION['all-data']['total_users_hidden'] is an int of the number of users //$users_images_paths is an array which stores the tmp file paths to a new destination ["..\uploads\random_identifier.jpeg","..\uploads\random_identifier_2.jpeg",etc..] try{ if($_SESSION['all-data']['total_users_hidden'] > 1){ for ($i=1 ; $i <= $_SESSION['all-data']['total_users_hidden']; $i++) { $image_path = "user_picture_".$i; $upload_user_images = move_uploaded_file($_FILES[$image_path]["tmp_name"], $users_images_paths[$i-1]); } }else{ $image_path = "user_picture_1"; $upload_user_image = move_uploaded_file($_FILES[$image_path]["tmp_name"], $users_images_paths); } }catch(\Throwable $e){ $errormsg=$e->getMessage(); user_log("Sorry, there was an error uploading your file. Error is:".$errormsg,"error"); } ---- Server IP: 45.112.84.4 Probable Submitter: 80.90.5.137 (proxied: 178.38.99.227) ---- Manual Page -- https://php.net/manual/en/function.move-uploaded-file.php Edit -- https://main.php.net/note/edit/130046 Del: integrated -- https://main.php.net/note/delete/130046/integrated Del: useless -- https://main.php.net/note/delete/130046/useless Del: bad code -- https://main.php.net/note/delete/130046/bad+code Del: spam -- https://main.php.net/note/delete/130046/spam Del: non-english -- https://main.php.net/note/delete/130046/non-english Del: in docs -- https://main.php.net/note/delete/130046/in+docs Del: other reasons-- https://main.php.net/note/delete/130046 Reject -- https://main.php.net/note/reject/130046 Search -- https://main.php.net/manage/user-notes.php

« previous php.notes (#221870) next »