php - how to rename file name while uploading -


i have file 2 input fields 1 file name (user type) , second 1 choosing file want upload file directory name user typed. down code i'm using guys please me how change file name user typed.

<?php  $filename = $_post["file"] $upload   = $_files['userfile'];   $target_path = "upload/";  $target_path .= $upload["name"];  $newname = "anything";  if(move_uploaded_file($upload["tmp_name"], $target_path))     {         echo "uploaded successfully";     } ?> 

change $target_path .= $upload["name"]; $target_path .= $filename;.

edit: record, have letting people upload files (and choose extension) web server raises serious security concerns. suggest @ least disabling ability execute scripts in target folder.


Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -