PHP No refresh File upload code

Source: Internet
Author: User

<?php
if (Isset ($_get[' action ')) && $_get[' action ']== ' update ')
{
Update notice data
Uploading files
Require_once ("upload_class.php");
$f = new Upload ($savepath, $fileFormat, $maxsize, $overwrite);
if (! $f->run (' img '))
{//The following IMG is the name of the input for the file uploaded in form
echo $f->errmsg (); Only the last error message can be delivered here, and the detailed information is available in $f->getinfo ().
Print_r ($f->returnarray);
}
echo "
<script src= "". __filename__. /js/jquery.js "type=" Text/javascript "></script>
<script>
var ptext= ';
Ptext= "OK";
Alert ($ (' #img_view '). html ());
parent.$ (' #img_view '). HTML (ptext);
</script> ";
}
?>
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 "/>
<link href= "{{$tempurl}}/admin.css" rel= "stylesheet" type= "Text/css"/>
<link href= "{{$baseurl}}/js/calendar/default/datepicker.css" rel= "stylesheet" type= "Text/css"/>
<script src= "{{$baseurl}}/js/calendar/wdatepicker.js" type= "Text/javascript" ></script>
<script src= "{{$baseurl}}/js/jquery.js" type= "Text/javascript" ></script>
<script src= "{{$baseurl}}/js/forms.js" type= "Text/javascript" ></script>
<script src= "{{$baseurl}}/js/formvalid.js" type= "Text/javascript" ></script>
<script type= "Text/javascript" >
Formvalid.succeed = function () {
$.post ("./article.php?action=update", $.getforms ("Update"), function (msg) {
Alert (msg);
if (msg== "update announcement succeeded")
{
Location.href ("./article.php");
}
Location.href ("{{$baseurl}}/index.php");
});
return false;
}
function File_addupload (type)
{
Responsible for adding picture input box
var ptext= ';
ptext=$ ("#" +type+ "_more"). HTML () + "<br/><input type= ' file ' name= '" "+type+" [] ' class= ' input '/> ';
$ ("#" +type+ "_more"). HTML (ptext);
}
</script>
<title> post-edit page </title>
<body >
<table width= "99%" border= "0" cellpadding= "0" cellspacing= "1" class= "Install" >
<tr>
&LT;TD colspan= "2" class= "title" > Edit article Content </td>
</tr>
{{section name=article loop= $article}}
<form action= "./article.php?action=update" method= "POST" name= "Update" enctype= "Multipart/form-data" target= " Upload_iframe ">
<input type= "hidden" name= "article_id" value= "{{$id}}" >
<tr>
&LT;TD class= "left" > article title:</td>
&LT;TD class= "right" ><input type= "text" id= "title" Name= "Article_title" value= "{{$article [article].title}}}" class= "Input" size= "valid=" required "errmsg=" article title can not be empty "/></td>
</tr>
<tr>
&LT;TD class= "Left" > Release ip:</td>
&LT;TD class= "right" ><input type= "text" id= "IP" value= "{{$article [Article].ip}}" Name= "IP" class= "input" ReadOnly/></td>
</tr>
<tr>
&LT;TD class= "Left" > author:</td>
&LT;TD class= "right" ><input type= "text id=" author "name=" Article_validtime "value=" {{{$article [Article]. Author}} "valid=" required "errmsg=" Please enter article author "/></td>"
</tr>
<tr>
&LT;TD class= "left" > Classification:</td>
&LT;TD class= "right" ><select name= ' sort ' >
{{html_options options= $sort _options selected= $article [Article].sort}}}
</select></td>
</tr>
<tr>
&LT;TD class= "Left" > Source:</td>
&LT;TD class= "right" ><input type= "text id=" comes "name=" comes "value=" {{$article [article].comes}} "class=" Input "/></td>
</tr>
<tr>
&LT;TD class= "Left" > is top:</td>
&LT;TD class= "right" >{{html_radios name= ' is_top ' options= $is _top_radios checked= $article [article].is_top Separator= ' _note= ' is top & #124;radio& #124;1=> is,0=> no '}}</td>
</tr>
<tr>
&LT;TD class= "Left" > Content:</td>
&LT;TD class= "Right" >{{$editor}}</td>
</tr>
<tr>
&LT;TD class= "left" > Picture upload:</td>
&LT;TD class= "Right" >
<span id= "Img_view" >
<input type= "File" Name= "img[]" class= "input"/>
<a href= "#" onclick= "File_addupload (' img ')" >++</a>
<span id= "Img_more" ></span>
</span>
</tr>
<tr>
&LT;TD class= "Left" > File upload:</td>
&LT;TD class= "right" ><input type= "file" Name= "file[]" class= "input"/>
<a href= "#" onclick= "file_addupload (' file ')" >++</a>
<span id= "File_more" ></span>
</td>
</tr>
<tr>
&LT;TD colspan= "2" class= "page" style= "Text-align:center;" ><input type= "Submit" name= "Submit" class= "button" value= "Save"/> <input type= "button" Name= "Article_return "Value=" returns "Class=" button "onclick=" Javascript:location.href ('./article.php '); "/></td>
</tr>
</form>
{{/section}}}
</table>
<iframe name= "Upload_iframe" style= "width:400px; height:100px; Display:none; " >
</iframe>
</body>

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.