Upload pictures (preview), videos, and add database small examples

Source: Internet
Author: User

Main Page:

<script src= ". /fzl/jquery-1.11.2.min.js "></script><script src=". /tanchuang/tanchuang.js "></script><script src=" Fenye.js "></script><title> Untitled document </ Title><style type= "text/css" >*{margin:0px auto; padding:0px}#file{width:200px; height:200px; opacity:0}#file1{width:200px; height:200px; opacity:0}#btn{width:200px; height:30px; font-size:24px}#pic{Display:none}#hidden_frame{Display:none}#a6{width:200px; height:200px; Background-image:url (chu/img/car.png); background-size:200px 200px}#a7{width:200px; height:200px; Background-image:url (chu/img/car.png); background-size:200px 200px}</style><?PHPinclude(".. /fzl/czy.class.php ");$db=NewCzy ();>PHP$sql= "SELECT * FROM Leibie"; $attr=$db->query ($sql); foreach($attr  as $v)    {        Echo"<option value= ' {$v[0]} ' >{$v[1]} </option> "; }    ?> </select></div><!--a1--><div id= "A2" > <span> Product Name: </span><input type= " Text "name=" name "style=" height:25px "/></div><!--a2--><div id=" A3 "> <span> Watch Price: </ Span><input type= "text" name= "Guankan" style= "height:25px"/></div><!--a3--><div id= "A4" > <span> Download Price: </span><input type= "text" name= "Xiazai" style= "height:25px"/></div><!-- A4--><div id= "A5" > <span style= "float:left" > Download Price: </span><textarea id= "XQ" style= "height : 50px; width:200px "></textarea></div><!--a5--><div id=" A6 "> <span style=" Float:left "> Picture path:</span> <input type= "file" name= "file" id= "file" onchange= "document.getElementById (' SC '). Submit ()"/&    Gt </div><!--a6--></div><!--a--></form><iframe name= "Hidden_ Frame "id=" Hidden_frame "></iframe><form action=" shipinxiazai.php "method=" post "enctype=" Multipart/form-data "><div id=" A7 "> <span style=" Float:left "> Video path: </span><input type= "file" Name= "File1" id= "file1"/></div><!--a6--><input type= " Submit "value=" Submission "id=" BTN "/></form></body>

Image + Information upload processing page:

<?PHPinclude(".. /fzl/czy.class.php ");$db=NewCzy (); //Upload file Limit   $t=Date("Ymdhis"); if((($_files["File"] ["type"] = = "Image/gif") | | ($_files["File"] ["type"] = = "Image/jpeg") | | ($_files["File"] ["type"] = = "Image/png")) && ($_files["File"] ["Size"] < 10000000))  {      //File Upload error      if($_files["File"] ["error"] > 0)    {        Echo"Upload error:".$_files["File"] ["Error"]. "<br/>"; }      Else    {                        //determine if the file already exists        $filename= "./ru/pic/".$t.$_files["File"] ["Name"];//Path to PHP        $filename=Iconv("UTF-8", "gb2312",$filename); if(file_exists($filename))        {              Echo"<script language= ' JavaScript ' >alert (' File already exists! ') </script> "; }        Else        {             //move picture to save path, solve Chinese garbled problem             Move_uploaded_file($_files["File"] ["Tmp_name"],$filename); Echo"<script language= ' JavaScript ' >parent.showimg ('". ") ru/pic/".$t.$_files["File"] ["Name"]. "') </script> ";//JS Path, to return to the page can not directly use the PHP path, to splice this path        }    }  }  Else  {      Echo"Upload Failed"; }

Video Upload Processing page:

<?PHPinclude(".. /fzl/czy.class.php ");$db=NewCzy (); //Upload file Limit   $t=Date("Ymdhis"); if(($_files["File1"] ["type"] = = "Video/avi") && ($_files["File1"] ["Size"] < 100000000))  {      //File Upload error      if($_files["File1"] ["error"] > 0)    {        Echo"Upload error:".$_files["File1"] ["Error"]. "<br/>"; }      Else    {    //determine if the file already exists        $filename= "./ru/video/".$t.$_files["File1"] ["Name"];//Path to PHP        $filename=Iconv("UTF-8", "gb2312",$filename);//echo $filename;        if(file_exists($filename))        {              Echo"<script language= ' JavaScript ' >alert (' File already exists! ') </script> "; }        Else        {    //move picture to save path, solve Chinese garbled problem             Move_uploaded_file($_files["File1"] ["Tmp_name"],$filename); }    }  }  Else  {      Echo"Upload Failed"; }

Upload pictures (preview), videos, and add database small examples

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.