TitleImportJava.io.BufferedInputStream;ImportJava.io.BufferedOutputStream;ImportJava.io.FileInputStream;ImportJava.io.FileOutputStream;ImportJava.io.FileReader;ImportJava.io.FileWriter;ImportJava.io.IOException;ImportJava.io.InputStream;ImportJava.io.OutputStream;ImportJava.io.Reader;ImportJava.io.Writer;/ * * Filereader/filewriter class * file character input/output stream */ Public class Test03 { Public Static void Main(string[] args)throwsIOEx
* Copy of text files can be achieved using FileReader and FileWriter.* For non-text files (video files, audio files, pictures), only the byte stream can be used!1 @Test2 Public voidTestfilereader () {3FileReader FR =NULL;4 Try {5File File =NewFile ("Dbcp.txt");6FR =Newfilereader (file);7 Char[] C =New Char[24];8 intLen;9 while(len = Fr.read (c))! =-1){TenString str =NewString (c, 0, Len); One System.ou
The code is as follows
Copy Code
More about the content reference
Ps://developer.mozilla.org/en/dom/filereader ">https://developer.mozilla.org/en/dom/filereader
Using Ajax is not directly uploaded files, is generally a new iframe in it to complete the form submission process to achieve the effect of asynchronous upload files.Doing so can achieve better browser compatibility, but the amount of code will be relatively large, even with the use of file upload plug-ins, such as Plupload.
How can you be flexible enough to treat a file as a normal form parameter like a normal AJAX submission form data?
Flash, the use of JavaScript
4 Main methods:Abort (): Interrupt read.Readasbinarystring (): reads the file as a binary code.Readasdataurl (): reads the file as Dataurl.Readastext (): reads the file as text.Event:Onabort: When interruptedOnError: Error whenOnLoad: Read successOnloadend: Read complete regardless of failure or successOnloadstart: Read startOnProgress: in Read2 Properties:Result: The value is only available after the read succeeds, and no is empty.ReadyState:0: for reading data1: Reading2: CompleteHTML5
Brief introduction
With the FileReader object, a Web application can asynchronously read the contents of a file (or raw data buffer) stored on a user's computer, and you can use a file object or a Blob object to specify the files or data that you want to work with. Where the file object can be from a user in a
More than one page, upload multiple pictures demo code
The above is the entire content of this article, I hope to learn JavaSc
Js achieves pure front-end image preview and js achieves pure image Preview
Image Upload is a common function, and image preview is an essential sub-function in the upload function. Before that, I subscribe to the onchange event of the input [type = file] element. Once the path is changed, the image is uploaded to the server, then obtain the image path and assign it to the img element. Regardless of the asy
A period of time ago wrote a JS data validation, JS email verification, JS URL verification, JS length verification, JS digital verification, such as pop-up dialog box form but, now not very popular kind of very unfriendly way, so rewrite a, packaged better, more friendly la
Some time ago I wrote a pop-up dialog box for js data verification, js email verification, js url verification, js length verification, and js digital verification. However, the unfriendly method is not very popular, so I wrote a new one, which is encapsulated better and sha
. style. cursor = "default ";
3. Document. Links get all links on the page
VaRLinks =Document. links;VaRArnames =[];For(VaRIInLinks) {arnames. Push (Links [I]);}For(VaRIInArnames) {document. Write (arnames [I]);}
Usage: Use the firebug plug-in of Firefox to run on the Sina homepage.
4. js onchange event, try throw catch for Form Verification
User Name Password Nbsp; Code
5. js shields all
Vue. js enables local image preview, cropping, compression, and uploading, and vue. js Cropping
The following code involves Vue 2.0 and ES6 syntax.
Target
Pure javascrpit implementation, compatible with ie9 and later browsers, checks the file format, length, width, and size locally to reduce browser interaction.
The reality is cruel. In order to be compatible with Ie9, we still use flash. The second article
[Node. js] uses the File API to upload files asynchronously, and node. jsapi
Address: http://www.moye.me/2014/11/05/html5-filereader/
Recently, I was working on a network disk project, which involved uploading large files. The question is: How can I display the File Upload progress in real time?Problem breakdown
It seems that I have done similar functional modules (based on the. NET platform) a few years a
I have been working on the web for some time. I want to share with you some experiences in loading JS files on the web.
1. First, let's talk about merging and compressing JS files.
To facilitate centralized management of JS merge and compression, we create a JS. ashx file to specifically handle merge compression. Here
This article mainly introduces four js key points that Node. JS developers must understand. Node. js is a server-oriented framework based on Chrome's powerful V8JS engine. Although it is compiled by C ++, it and its applications run on JS. If you need it, you can refer to this article to summarize four Node.
About the difference between node. js and JavaScript, you know? Do you know about the similarities between node. js and JavaScript? If you do not know, then don't come to see this article, you are still waiting for what, see now
First, let's look at the comparison between JS and node. JS:
Javascript:
ECMAScript (langu
This article will share with you the use of node. js is used to develop Weibo instances. After reading the nodejs Development guide, I found that many of the Code in the book is no longer available, because the express version has been upgraded, so today, I will try to develop Weibo instances and recommend them to you. I have been persistently engaged in front-end development before. In recent days, I started to learn nodejs. As a front-end developer,
This article mainly introduces what is Node. js? What are the advantages of Node. js ?, To try to explain what Node is. js, this article will briefly introduce some background information: the problem to be solved, how it works, how to run a simple application, and finally, what is a good solution for Node, if you need it, you can refer to Node as a server-side J
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.