Picture vote image Upload

Source: Internet
Author: User

Picture voting items, users upload three photos themselves, the program will upload three photos uploaded to the seven cattle server, and the callback saved in the address of the seven cattle server to the link to their own database.

Image upload
$ (' #upload '). Click (function () {
var inputsize = $ ("#photo_value_cont >input"). Size ();
if (inputsize >= 3) {
Alert ("Upload up to three photos!") ");
Return
}
var $btn = $ (' #upload ');
if ($ (this). Hasclass (' disabled '))
Return
$btn. addclass ("Disabled");
$ (' #photo '). Click ();
});
$ ("#photo_preview_cont. Close"). Live ("Click", Function () {
var index = $ (this). Parent (). index ();
$ (this). Parent (). remove ();
$ ("#photo_value_cont"). Find ("input"). EQ (index). Remove ();
});

var index = 1;
$ (' #photo '). Change (function () {
var dom = $ ("<span data-index=" + index + "><span class= ' close ' >X</span></span> ');

$ (' #photo_preview_cont '). Append (DOM);
Start processing upload pictures
Imgpreview (Dom.find (' img '), this, function (Imgurl) {
Image upload Successful callback method
var $btn = $ (' #upload ');
var inputsize = $ ("#photo_value_cont >input"). Size ();
if (Inputsize < 3) {
$ ("#photo_value_cont"). Append ("<input type= ' hidden ' value= '" +imgurl+ "'/>");
}
});
});

Note: You need to add seven kn tokens to the page.

<script type= "Text/javascript" >

var window.qiniuuptoken= ' <%=qiniuuptokenutil.getuptoken ()%> ';
Window.uploadbasepath = "base64upload/nianhui/<%=aid%>/";

</script>

<!--registration Submission module--
<article class= "SetInfo" id= "SetInfo" >
image/mobile/djzb/info.jpg?v=1"/>
<input type= "text" name= "username" class= "username" id= "username" value= ""/>
<input type= "Tel" name= "Tel" id= "Tel" class= "tel" value= "/>
<textarea name= "Userwords" rows= "class=" Userwords "cols=" "placeholder=" Manifesto keyword: beauty, temperament, goddess, God, diamond, jewelry "></ Textarea>
<a class= "Saveinfo" href= "javascript:void (0);" ></a>
<a href= "javascript:void (0);" class= "Beauty Disable1" > Goddess </a>
<a href= "javascript:void (0);" class= "Handsome Disable2" > Gods </a>
<a href= "javascript:void (0);" id= "Upload" ></a>
<div id= "Photo_preview_cont" >
</div>
<input type= ' file ' accept= "image/*" style= "display:none;" name= ' photo ' id= ' photo '/>
<div id= "Photo_value_cont" ></div>
<input type= ' hidden ' name= ' sex ' id= ' sex ' value= ""/>
<input type= ' hidden ' name= ' itemId ' class= ' itemId ' value= ' 0 '/>
<div class= "Baomin_rule" >
<p class= "P_title" >
<span>image/mobile/djzb/zuan2.png?v=1" ></span> Registration details
</p>
<p class= "p_content" >1, fill in the real name, contact telephone and city, in order to ensure that the contestants successfully won the prize, please ensure the authenticity of the information. </p>
<p class= "P_content" >2, each number can upload 3 photos, request a recent positive photo (bust, full body photo). The Grand Duke Jewellery will review the contestants ' photographs for their fineness and regularity, and after the examination, the registration is successful. </p>
<p class= "P_content" >3, write down 20~200 words of the entry declaration, the key word for "goddess", "Male God", "Yan value", "temperament", "Diamond", "jewelry". </p>
</div>
</article>

Picture vote image Upload

Related Article

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.