webForumDet fria alternativet

problem med upload script

0 svar · 258 visningar · startad av mikaelweb

mikaelwebMedlem sedan aug. 200217 inlägg
#1

Hur kan man få detta script att titta om samma fil name redan finns ( det funkar redan) men att den inte laddar upp med samma namn om detta fil är av annan storlek

Just nu skriver den över den gamla Typ nisse.gif 12kb med nisse.gif 14.kb

hur ¨kan jag hidra detta

<?
		  /*
            Author: 	Mikaelweb.com
            Version:	upload script v 1.0
            Date:		16.10.2004
            E-mail:		[email]webmaster@mikaelweb.com[/email]
            Home page :	mikaelweb.com
			Copyright © 2004 mikaelweb.com. All Right Reserved.*/
        
		  // this is the upload dir where files will go.
          //Don't remove the /
           $uploaddir = "/home/test/public_html/images/partners/";  
           if(isset($Submit))
           {
                    //a file was uploaded via HTTP_POST_FILES. 
					 if(($HTTP_POST_FILES['imagefile']['type'] == "image/gif") || ($HTTP_POST_FILES['imagefile']['type'] == "image/.jpg")){
        			 $file_realname = trim($HTTP_POST_FILES['imagefile']['name']);
					 
					 // Check if file is Already EXISTS.
					 if(file_exists($uploaddir.$file_realname)){
                     echo "Oops! The file named <b>$file_realname </b>already exists";
                     exit();
                    } 
					
				    //Move the File to the Directory of your choice.
    				 move_uploaded_file($HTTP_POST_FILES['imagefile']['tmp_name'], $uploaddir . $file_realname) 
   					 or die ("<b><font color='#9CA1B4'>Ohhhhhhhhhhhhhh!</font></b><br>
		 			 I could not copy your button :(<br><br>
			 		 <font color='#EB7D05'>« </font><a href=\"javascript:history.go(-1)\">Lets try again!</a>");
					 
					 //This part puts you file name to database.
					 include "test.php";
					 $sitebutton = "http://www.your site.com/images/partners/$file_realname";		
					 mysql_query("insert into partners (name, last, info, email, sitename, link, linkb, status) values ('$name', '$last', '$info', '$email', '$sitename', '$link', '$sitebutton', '0')");
					 $result = mysql_query("SELECT * FROM partners WHERE sitename='$sitename'");
					 $row = mysql_fetch_array($result);
                     $xis = "http://www.your site.com/inout.php?inid=";
					 
					 //tell the user that the file has been uploaded
        			 echo "<b><font color='#9CA1B4'>Congratulations</font></b><br>
		      		 you´r now my partner :p<br><br>
		      		 Please download my button and use this url to link me:<br>
			  		 <font color='#9CA1B4'>$xis$row[id]</font><br><br>
			  		 <font color='#EB7D05'>« </font><a href=\"index.php?action=join\">Lets see if i put your button correctly!</a>";
					 
        			} 
					else{
					
					//Print error
					   echo "<b><font color='#9CA1B4'>Ohhhhhhhhhhhhhhhh!</font></b><br>
		               I could not copy your button :(<br>
				       Wrong Filetype (<font color='#9CA1B4'>".$HTTP_POST_FILES['imagefile']['name']."</font>)<br><br>
			           <font color='#EB7D05'>« </font><a href=\"javascript:history.go(-1)\">Lets try again!</a>";             
					 	}
				}//end of this upload script
?>
134 ms totalt · 3 externa anrop · v20260731065814-full.30151723
0 ms — hämta forumlista (cache)
0 ms — hämta statistik (cache)
131 ms — hämta tråd, inlägg och bilagor (db)