php - Uploading multiple images with random file names -


Right now, all the images are uploaded properly with their filenames, but I can change the filenames to random names Avoid names with symbols you want) But when I try to do this, if I upload more than one image, then all of them will be the same image of the last selected file.

  & lt; Input type = 'file' name = 'file []' & gt;  

More conditions:

  $ permission = array ('jpg', 'jpg', 'jpeg', 'png', 'bmp', ' Quarrel ',' gif '); $ Max_file_size = 2048 * 1000; $ Path = "picture / picture /"; // directory $ count = 0 Upload; If ($ $ _FILES ['file'] ['name']! = "") {Foreach ($ _FILES ['file '] [' Name '] as $ F = & gt; $ name) {if ($ _FILES [' file '] [' error '] [$ f] == 4) {continue; } If $ $ _FILES ['file'] ['error'] [$ f] == 0} {if ($ _FILES ['file'] ['size'] [$ f]> $ max_file_size) {$ Errors [] = "$ name is too big!"; to continue; } Else if (! In_array (pathinfo ($ name, PATHINFO_EXTENSION $ $)) {$ errors [] = "$ name is not a valid format"; to continue; } $ Images = array ('images' = & gt; $ path. $ Name, and' 'Ad_id' = & gt; $ _POST ['id']); Add_images ($ images); $ Count ++; }}}}}}  

You can add index to image name. Try changing (move_uploaded_file ($ _FILES ["file"] ["tmp_name"] [$ f], $ path. $ Name) if

             'images' = & gt; $ path. $ Name, ) 


Comments

Popular posts from this blog

ios - How do I use CFArrayRef in Swift? -

eclipse plugin - Run java code error: Workspace is closed -

c - Error on building source code in VC 6 -