Overview
This article explains a use of Office Star Control to achieve background automatic upload file example, using this method does not select a file step, you can achieve in the Web environment similar to a stand-alone environment click Save File Effect.
Introduction
In order to obtain the upload function in the HTML webpage, we can use the form in the following format in the client:
<form name= "MyForm"
action= "Targeturl.asp"
Enctype= "Multipart/form-data"
Method= "POST" >
<input type= "File" name= "MyFile" >
<input type= "Submit" value= "Upload File" >
</FORM>
This scenario has many limitations on both the client and server side. First, we must use the Post method, because the Get method cannot process such form data. Also, there is no way to raise a post action without using the form. Once the data is sent to the form handler, the browser will load the handler as a new page, and the user will see a page conversion process that is not pleasing to the person.
The uploading scheme in the Office Star control
You need to follow these steps:
Client:
Save the document edited by the Office Star Control to a local
To send a saved temporary document to a Web server using the HTTP protocol
Server side:
Read the uploaded binary document from the request object
Reads the binary data and stores it in a BLOB field in the database.
With Office star controls you can implement word-and-text blending and word processing in a web environment, but how do you save the edited document to the server side? There seems to be nothing new in the above plan. As stated in the preface, the value of the file control is read-only, and there must be a process of selecting the document manually clicking the Upload button. Is that right? First, we introduce the two Office star Control interface methods:
1. Savetotempfile (str filename)
Saves the document currently edited with the Office Star Control to local form a temporary file with the filename file name of the temporary file. The method returns a parameter that represents the absolute path of the temporary file. Example: Savetotempfile ("Abc.ost")
2. UploadFile (str filepath,str operatorfile)
Uploads the locally specified file to the server side, with the parameter filepath as the absolute path to the local file to be uploaded, Operatorfile for the file name that the server side uses to receive the uploaded file stream. The method returns a parameter that prompts for success during the operation. Example: UploadFile ("C:abc.ost", "http://www.oapro.com/save.asp")
See here, I believe you already understand, Office Star Control has provided an interface method to automatically upload the specified file. The complete code for the client is given below:
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.