php - Rename while uploading -


i'm not familiar php, but... have 1 form 2 upload files filds, 1 arhive, , other thumbnail it. puts names mysql table. @ first, nice rename files if exists dirs, , can't that. , second, upload image, can't make make thumbnail specific proportions.

my forms:

<form method="post" action="up.php" enctype="multipart/form-data">         <p>           firstname:         </p>         <input type="text" name="firstname"/>          <p>           lastname:         </p>         <input type="text" name="lastname"/>         <p>           please upload photo.         </p>         <p>           photo:         </p>         <input type="hidden" name="size" value="350000">         <input type="file" name="photo">          <p>          arhiv:         </p>         <input type="hidden" name="size" value="350000">         <input type="file" name="sub">          <p>           middlename:         </p> 

address:



and upload.php

    <?php  //this directory images saved $arhiv = "files/"; $arhiv = $arhiv . basename( $_files['sub']['name']); $target = "upl/"; $target = $target . basename( $_files['photo']['name']);  //this gets other information form $firstname=$_post['firstname']; $lastname=$_post['lastname']; $poster=($_files['photo']['name']); $middlename=$_post['middlename']; $address=$_post['address']; $arhiv=($_files['sub']['name']);  // connects database mysql_connect("localhost", "root", "pass") or die(mysql_error()) ; mysql_select_db("asc_desc") or die(mysql_error()) ;  //writes information database mysql_query("insert member (firstname,lastname,poster,middlename,address,arhiv) values ('$firstname', '$lastname', '$poster', '$middlename', '$address', '$arhiv')") ;  //writes photo server if(move_uploaded_file($_files['photo']['tmp_name'], $target)); if(move_uploaded_file($_files['sub']['tmp_name'], $arhiv)) {  //tells if ok echo "the file ". basename( $_files['photo']['name']). " has been uploaded, , information has been added directory"; echo "<p>the file ". basename( $_files['sub']['name']). " uploaded, too"; } else {  //gives , error if not echo "sorry, there problem uploading file."; }  ?> <p> <a href="1.php">back form</a> 


Comments

Popular posts from this blog

PHPMotion implementation - URL based videos (Hosted on separate location) -

c# - Unity IoC Lifetime per HttpRequest for UserStore -

I am trying to solve the error message 'incompatible ranks 0 and 1 in assignment' in a fortran 95 program. -