php - I need to upload and rename an image onto my server -


i'm unskilled @ php i'm afraid have no code provide, don't think need difficult make anyway.

i need create form 2 inputs, "name" field , browse file field, upload image onto folder in server , rename image whatever in "name" field. appreciated, thank you!

you can use following code

html file upload form

<form name="fileupload"  action="upload.php" method="post" enctype="multipart/form-data">        <input type="text" id="name" name="name" maxlength="40" required data-validation-required-message="please select name.">        <input type="file" id="file" name="file_name" maxlength="40" required data-validation-required-message="please select photo.">        <input type="submit" value="upload photo"/>        </form>

now upload.php file should this.

<?php  $album_name = filter_input(input_post, 'name');  $oldfilename = $_files["file_name"]["name"]; // file name    move_uploaded_file($filetmploc, "your upload file path" .$filename);    $newfilename = "new name";    rename ( "your upload file path/" .$oldfilename$ , "your upload file path/" .$newfilename )  ?>


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

jquery - javascript onscroll fade same class but with different div -