Add image upload function to freetextbox (continued)

Source: Internet
Author: User

In "add image upload function to freetextbox", we implemented the image upload function. However, in actual use, I found some minor problems, such as automatically adding domain names, this makes the migration of the website inconvenient, for example. After some research, we have finally successfully solved these small problems, made a record in the form of this article, and shared it with you.

 

The original idea was to return " ", and the Editor automatically adds the domain name to us :(.

After reading the Js of freetextbox, we found the executecommand function, which makes it easy for us to create an IMG object. First, we need to extend a method called insertpuresrc:

FTB_FreeTextBox.prototype.InsertPureSrc = function(imgSrc) {if (imgSrc != '') {this.ExecuteCommand('insertimage',null,imgSrc);}}

Here, imgsrc is the image address, and then we modify a piece of returned content that is uploaded successfully:

//string s = "opener.InsertText('" + s + @"');window.close();</script>");Response.End();

Directly return the image address, and finally modify the inserttext function called for the insertpuresrc we added above:

function InsertText(textToInsert) {FTB_API['<%=FreeTextBox1.ClientID %>'].InsertPureSrc(textToInsert);}

This completes. upload an image and try it. Now we have inserted the returned content. The domain name is not automatically added, as shown in.

 

  • Download the sample code in this 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.