CN106936904A - A kind of picture upload method and device - Google Patents

A kind of picture upload method and device Download PDF

Info

Publication number
CN106936904A
CN106936904A CN201710131406.7A CN201710131406A CN106936904A CN 106936904 A CN106936904 A CN 106936904A CN 201710131406 A CN201710131406 A CN 201710131406A CN 106936904 A CN106936904 A CN 106936904A
Authority
CN
China
Prior art keywords
applet
picture
client
uploaded
web page
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201710131406.7A
Other languages
Chinese (zh)
Inventor
王秀鹏
邵辉
曹雪韬
汤海波
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Jinan Inspur Hi Tech Investment and Development Co Ltd
Original Assignee
Jinan Inspur Hi Tech Investment and Development Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Jinan Inspur Hi Tech Investment and Development Co Ltd filed Critical Jinan Inspur Hi Tech Investment and Development Co Ltd
Priority to CN201710131406.7A priority Critical patent/CN106936904A/en
Publication of CN106936904A publication Critical patent/CN106936904A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/02Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
    • H04L67/025Protocols based on web technology, e.g. hypertext transfer protocol [HTTP] for remote control or remote monitoring of applications
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/955Retrieval from the web using information identifiers, e.g. uniform resource locators [URL]
    • G06F16/9554Retrieval from the web using information identifiers, e.g. uniform resource locators [URL] by using bar codes
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/06Protocols specially adapted for file transfer, e.g. file transfer protocol [FTP]

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The invention provides a kind of picture upload method and device, the method includes:Applet Applet is loaded in outside client;The trigger event that the client conducts interviews to triggering WEB page is received, wherein, the HTML html file code of the triggering WEB page includes that Applet is marked;According to the trigger event, picture is obtained from the Applet and uploads Applet treatment classes;Applet is uploaded by the picture and processes class, the picture to be uploaded in the client is packaged;Picture described to be uploaded after HTTP HTTP is by encapsulation is uploaded to the server of outside.The device includes:Loading unit, acquiring unit, encapsulation unit and uploading unit.This programme can lift the experience of user.

Description

A kind of picture upload method and device
Technical field
The present invention relates to field of computer technology, more particularly to a kind of picture upload method and device.
Background technology
As continuing to develop for computer technology is led with progress, each during computer is widely used in living and producing Domain, during computer use, is frequently encountered the picture that will be stored in local computer by webpage and uploads onto the server Situation.
At present, when needing will be stored in the picture on local computer and uploading onto the server, this is manually selected by user Picture on ground computer, clicks on upload button and picture uploads onto the server.
Be directed to existing picture uploads onto the server method by webpage, it is necessary to user manually complete picture selection and The action that upload button is clicked on, but picture need not carry out selection under application scenes, such as clap camera The monitoring photo taken the photograph all uploads onto the server, and the mode that now user stills need to be manually operated constantly repeats to select local The action of picture and click upload button on computer, causes Consumer's Experience poor.
The content of the invention
A kind of picture upload method and device are the embodiment of the invention provides, the experience of user can be lifted.
In a first aspect, the embodiment of the invention provides a kind of picture upload method, small answering is loaded in outside client Program Applet is used, is also included:
The trigger event that the client conducts interviews to triggering WEB page is received, wherein, the triggering WEB page HTML html file code includes that Applet is marked;
According to the trigger event, picture is obtained from the Applet and uploads Applet treatment classes;
Applet is uploaded by the picture and processes class, the picture to be uploaded in the client is packaged;
Picture described to be uploaded after HTTP HTTP is by encapsulation is uploaded to the server of outside.
Preferably,
The loading applet Applet in outside client, including:
The process that the client accesses WEB page is monitored;
Judge whether the client is access triggers WEB page first;
If it is, obtaining the Applet from the server, and the Applet is loaded into the client.
Preferably,
It is described the Applet is loaded into the client after, further include:
The Applet is compiled to form Java class files, and the Java class files are embedded into institute Triggering WEB page is stated, the Applet is loaded into the client with when the triggering WEB page is opened again.
Preferably,
The picture that obtained from the Applet uploads Applet treatment classes, including:
It is indexed in the Applet by name attribute, obtains picture and upload Applet;
It is indexed in the picture uploads Applet by store path attribute, obtains the Java uploaded for picture The path of archive file Jar bags;
It is indexed in the path of the Jar bags by encoded attributes, obtains the picture and upload Applet treatment classes.
Preferably,
It is described the picture to be uploaded in the client is packaged by picture upload Applet treatment class, wrap Include:
Call the picture to upload the picture upload method that Applet processes class, create abstract class HttpURLConnection objects, by the HttpURLConnection objects to the picture to be uploaded in the client It is packaged.
Second aspect, the embodiment of the present invention additionally provides a kind of picture and uploads device, including:Loading unit, acquiring unit, Encapsulation unit and uploading unit;
The loading unit, for loading applet Applet in outside client;
The acquiring unit, for receiving the client to the triggering trigger event that conducts interviews of WEB page, and according to The trigger event obtains picture from the Applet that the loading unit is loaded and uploads Applet treatment classes;Wherein, institute Stating the HTML html file code of triggering WEB page includes that Applet is marked;
The encapsulation unit, the picture for being got by the acquiring unit uploads Applet treatment classes, right Picture to be uploaded in the client is packaged;
The uploading unit, for the upload after HTTP HTTP encapsulates the encapsulation unit Picture is uploaded to the server of outside.
Preferably,
The loading unit, the process for accessing the client WEB page is monitored, and judges the client Whether it is access triggers WEB page first, if it is, obtain the Applet from the server, and by the Applet It is loaded into the client.
Preferably,
The picture uploads device and further includes:Embedded unit;
The embedded unit, for being compiled to form Java class to the Applet that the loading unit is loaded File, and the Java class files are embedded into the triggering WEB page, beaten again with the triggering WEB page The Applet is loaded into the client when opening.
Preferably,
The acquiring unit includes:Obtain subelement;
The acquisition subelement, for being indexed in the Applet by name attribute, is obtained picture and uploaded Applet;It is indexed in the picture uploads Applet by store path attribute, obtains the Java uploaded for picture The path of archive file Jar bags;It is indexed in the path of the Jar bags by encoded attributes, obtains the picture and upload Applet processes class.
Preferably,
The encapsulation unit, for calling the picture to upload the picture upload method that Applet processes class, creates abstract Class HttpURLConnection objects, by the HttpURLConnection objects to the figure to be uploaded in the client Piece is packaged.
A kind of picture upload method and device are the embodiment of the invention provides, after loading Applet on the client, works as visitor When family end conducts interviews to the triggering WEB page for including Applet marks, picture upload is obtained from the Applet for being loaded Applet processes class, and picture uploads Applet treatment class and the picture to be uploaded in client can be packaged, and then can be with Picture to be uploaded after HTTP is by encapsulation uploads onto the server.As can be seen here, when client is visited triggering WEB page When asking, if there are picture to be uploaded in client, upload Applet automatically by picture and process class to figure to be uploaded Piece is packaged, and uploads onto the server, and picture upload procedure is manually operated without user, so as to improve the experience of user.
Brief description of the drawings
In order to illustrate more clearly about the embodiment of the present invention or technical scheme of the prior art, below will be to embodiment or existing The accompanying drawing to be used needed for having technology description is briefly described, it should be apparent that, drawings in the following description are the present invention Some embodiments, for those of ordinary skill in the art, on the premise of not paying creative work, can also basis These accompanying drawings obtain other accompanying drawings.
Fig. 1 is a kind of flow chart of picture upload method that one embodiment of the invention is provided;
Fig. 2 is a kind of flow chart of picture upload method that another embodiment of the present invention is provided;
Fig. 3 is the schematic diagram that a kind of picture that one embodiment of the invention is provided uploads equipment where device;
Fig. 4 is the schematic diagram that a kind of picture that one embodiment of the invention is provided uploads device;
Fig. 5 is the schematic diagram that a kind of picture that another embodiment of the present invention is provided uploads device.
Specific embodiment
To make the purpose, technical scheme and advantage of the embodiment of the present invention clearer, below in conjunction with the embodiment of the present invention In accompanying drawing, the technical scheme in the embodiment of the present invention is clearly and completely described, it is clear that described embodiment is A part of embodiment of the present invention, rather than whole embodiments, based on the embodiment in the present invention, those of ordinary skill in the art The every other embodiment obtained on the premise of creative work is not made, belongs to the scope of protection of the invention.
As shown in figure 1, the embodiment of the invention provides a kind of picture upload method, the method may comprise steps of:
Step 101:Applet Applet is loaded in outside client;
Step 102:The trigger event that the client conducts interviews to triggering WEB page is received, wherein, the triggering The HTML html file code of WEB page includes that Applet is marked;
Step 103:According to the trigger event, picture is obtained from the Applet and uploads Applet treatment classes;
Step 104:Applet is uploaded by the picture and processes class, the picture to be uploaded in the client is sealed Dress;
Step 105:Picture described to be uploaded after HTTP HTTP is by encapsulation is uploaded to the clothes of outside Business device.
A kind of picture upload method is the embodiment of the invention provides, after loading Applet on the client, when client pair When the triggering WEB page for including Applet marks conducts interviews, picture upload Applet is obtained from the Applet for being loaded Treatment class, picture uploads Applet treatment class and the picture to be uploaded in client can be packaged, and then can pass through HTTP by encapsulation after picture to be uploaded upload onto the server.As can be seen here, when client conducts interviews to triggering WEB page When, if there are picture to be uploaded in client, upload Applet treatment class automatically by picture and treat uploading pictures It is packaged, and uploads onto the server, picture upload procedure is manually operated without user, so as to improves the experience of user.
In an embodiment of the invention, when loading Applet on the client in step 101, WEB is accessed to client The process of the page is monitored, and is directed to access process each time and is monitored, and judges whether client is access triggers first WEB page, if it is, Applet is obtained from server, and the Applet that will be got is loaded into client.
Specifically, when the html file code of WEB page includes that Applet is marked, illustrate that the WEB page can be adjusted With Applet, when client includes that the triggering WEB page of Applet marks conducts interviews to html file code first, from Server downloads Applet, and the Applet of download is loaded into client.So as to there is picture to be uploaded on the client When, the picture included using Applet uploads Applet treatment class to be treated uploading pictures and is packaged, and then by figure to be uploaded On piece is uploaded onto the server.So, during client conducts interviews to triggering WEB page, whenever occurring treating in client During uploading pictures, picture to be uploaded can be uploaded onto the server automatically, and whole process is without manually operating, it is ensured that user With preferably experience.
In an embodiment of the invention, after loading Applet on the client in step 101, carried out by Applet Compiling forms Java class files, and the Java class files that will be formed are embedded into triggering WEB page.
Specifically, after Applet is loaded into client, Applet is compiled by client forms Java Class files, and Java class files are embedded into triggering WEB page, each client accesses html file generation later When code includes the triggering WEB page of Applet marks, Applet can be carried out as triggering WEB page is loaded into client Operation.So, after Applet is loaded into client, when next time calls again, without being loaded from server again, due to saving The time of Applet is re-downloaded from server, such that it is able to improve the speed of picture upload.
In an embodiment of the invention, after the triggered time that client conducts interviews to triggering WEB page is received, First, it is indexed in Applet by title (name) attribute, the picture found for uploading pictures to server is uploaded Applet;Then, it is indexed in picture uploads Applet by store path (archive) attribute, is found for uploading Picture is wherein packaged with acquisition client image data correlative code to the path of the Jar bags of server in Jar bags;Finally lead to Cross coding (code) attribute to be indexed under the path that Jar includes, obtain picture and upload Applet treatment classes.
Specifically, the picture for uploading pictures to server is found by the name attributes ImageSave of Applet Applet is passed, the path of ImageSave.jar is found by archive attributes, and then find Applet's by code attributes Treatment class ImageSave, treatment class ImageSave are picture and upload Applet treatment classes.Due to client picture will be obtained Data correlative code is all encapsulated into ImageSave.jar, it is only necessary to used in the page by being introduced into corresponding Jar bags, tool There is good ease for use and compatibility, so as to improve the applicability of the picture upload method that the embodiment of the present invention is provided.
In an embodiment of the invention, step 104 is treated uploading pictures and is carried out using picture upload Applet treatment class During encapsulation, call picture to upload the picture upload method that Applet processes class, create abstract class HttpURLConnection pairs As being packaged to the picture to be uploaded in client by HttpURLConnection objects.
Specifically, because HttpURLConnection is a kind of multipurpose, the HTTP clients of lightweight, it is adaptable to big Most application programs, supports caching function, with good ease for use and autgmentability, therefore, call picture to upload Applet After processing the picture upload method establishment HttpURLConnection objects of class, treated by HttpURLConnection objects The method that uploading pictures are packaged, goes for the picture to be uploaded and various types of clients of various forms, enters One step improves the applicability of the picture upload method.
Vehicle is weighed as a example by picture uploads by grain depot system below, on the picture provided the embodiment of the present invention Transmission method is described in further detail, as shown in Fig. 2 the method may comprise steps of:
Step 201:Access triggers WEB page, client is loaded into by Applet from server.
In an embodiment of the invention, the process that client accesses WEB page is monitored, when monitoring client When including that the triggering WEB page of Applet marks conducts interviews to HTML (HTML) document code first, from Server obtains Applet, and the Applet that will be got is loaded into client.
For example, in grain depot, in order to avoid grain weighs risk present in process, when carrying grain vehicle and passing through weighbridge, Two cameras catch the picture carried during grain vehicles weigh before and after the weighbridge, and on the picture that will be collected Server is reached, for the voucher settled accounts as grain money.With grain depot management software as client, the page of weighing is used as triggering WEB The page.When grain depot management software is accessed first weighs the page, downloaded from the server being connected with grain depot management software Applet, and the Applet that will be downloaded is loaded on grain depot management software.
Step 202:Applet is compiled to form Java class files, and Java class files is embedded into tactile Hair WEB page.
In an embodiment of the invention, need to be compiled Applet when loading Applet on the client, Java class files are produced after Applet is compiled, produced Java class files are embedded into triggering WEB page.
For example, it is necessary to be compiled to Applet when loading Applet on grain depot management software, by produced by compiling After Java class files are embedded into the page of weighing, later every time access weigh the page when, will automatically load Applet.
Step 203:Receive picture and upload triggering, picture is obtained from Applet and uploads Applet treatment classes.
In an embodiment of the invention, after receiving picture upload triggering, use is found by name attributes ImageSave Applet is uploaded in the picture of uploading pictures to server, the path of ImageSave.jar is found by archive attributes, entered And pass through the treatment class ImageSave that code attributes find Applet.Treatment class ImageSave is picture and uploads at Applet Reason class.Wherein, it can be that triggering WEB page is conducted interviews that picture uploads triggering, i.e., when client access triggers WEB page When, trigger and the action that picture uploads Applet treatment classes is obtained from Applet.
For example, when grain depot management softward interview weighs the page, being obtained from the Applet being carried on grain depot management software Take picture and upload Applet treatment classes.
Step 204:Applet treatment class is uploaded by picture to be packaged the picture to be uploaded in client.
In an embodiment of the invention, after picture upload Applet treatment classes are got, picture is called to upload Applet processes picture upload method saveImage () of class, creates HttpURLConnection objects, sets related ginseng Number, create input and output flow object, by the information of picture to be uploaded in client read output stream in, setting will be sent to clothes The HTTP request address of business device.
For example, calling picture to upload the method for uploading that Applet processes class, HttpURLConnection objects are created, will Input object is set to the server being connected with grain depot management software, and object output is set into grain depot management software, will image The information of the vehicle that collects of head weighs picture 1 and vehicle weighs picture 2 is read in output stream.
Step 205:Picture to be uploaded after HTTP is by encapsulation uploads onto the server.
In an embodiment of the invention, in the information of picture to be uploaded in client being read into output stream, and complete After corresponding setting, HTTP request is sent to server, pictorial information is sent to server in the form of exporting stream.
For example, grain depot management software sends HTTP request to server, vehicle is weighed into picture 1 and vehicle weighs picture 2 Pictorial information server is sent in the form of exporting stream.
Step 206:The HTTP request that server parsing client sends, server is saved in by picture.
In an embodiment of the invention, server obtains the picture input flow data of client transmissions, sets picture After storing path and filename, by under picture to be uploaded storage to the file specified.
For example, after server receives the picture output flow data of grain depot management software transmission, on grain depot management software The vehicle of biography weighs picture 1 and vehicle weighs, and picture 2 is stored, in case corresponding vehicle used during two clearing.
In an embodiment of the invention, after system trigger upload function, the figure to server for uploading pictures is obtained Piece upload Applet treatment class process can be realized by scripted code, can specifically include code below:
<APPLET code=" ImageSave.class "
Archive="<loushang:uipath/>jsp/genersoft/pub/applet/ecard/imageSave/ Ima geSave.jar"
Name=" ImageSave "
Height=" 0 " // setting Applet is hiding
Width=" 0 "
Hspace=" 0 "
Vspace=" 0 ">
</APPLET>。
In an embodiment of the invention, uploading pictures are treated to be packaged, and sends HTTP request to the mistake of server Journey can also be realized by scripted code, can specifically include code below:
// define the HTTP request address that client is sent to the preservation picture of server
String url=sinopath+ " imageSaveCmd.cmdMethod=imageSave&djnm="+ djnm;
// url is packaged into URL objects
URL urlObj=new URL (url);
// set up connection
HttpURLConnection con=(HttpURLConnection) urlObj.openConnection ();
// arrange parameter
con.setRequestMethod("POST");
con.setDoInput(true);
con.setDoOutput(true);
con.setUseCaches(false);
con.setRequestProperty("Connection","Keep-Alive");
con.setRequestProperty("Charset","UTF-8");
con.setRequestProperty("Content-Type","multipart/form-data");
// create output flow object
OutputStream out=new DataOutputStream (con.getOutputStream ());
// input flow object is created, read data from local computer specified file
DataInputStream in=new DataInputStream (new FileInputStream (file));
Int bytes=0;
Byte [] bufferOut=new byte [1024];
// reading client file data is write in output flow object
While ((bytes=in.read (bufferOut))!=-1)
out.write(bufferOut,0,bytes);
}
// close iostream
in.close();
out.flush();
out.close();
// the complete HTTP request of packaged image data is sent to server.
BufferedInputStreaminputStream=newBufferedInputStream (con.getInputStream())。
In an embodiment of the invention, the HTTP request that server parsing client sends, preserves picture to server Process can also be realized by scripted code, with code below can be included:
// obtain server path
String filepath=req.getSession () .getServletContext () .getRealPath ("/");
File file=new File (filepath);
if(!file.exists()){
file.mkdirs();
}
try{
String time=DateTool.getCurrentTimeMillisAsString (" yyyyMMddHHmmss ");
Int v=0;
// obtain inlet flow
BufferedInputStreaminputStream=newBufferedInputStream (req.getInputStream());
String djnm=req.getParameter (" djnm ");
// picture storing path and filename are set
Filepath=filepath+djnm+ " .jpeg ";
Byte [] bytes=new byte [1024];
FileOutputStreamfos=new FileOutputStream (filepath);
BufferedOutputStreambos=new BufferedOutputStream (fos, 1024*1024*5);
Byte [] data=new byte [1024*1024];//1mb
intlen;
// uploading pictures are under the specified folder of server
While ((len=inputStream.read (data, 0, data.length))!=-1)
bos.write(data,0,len);
}
// manual clearing buffers space
bos.flush();
// close iostream
inputStream.close();
bos.close();
}catch(IOException e){
System.out.println(e.getMessage());
}。
As shown in Figure 3, Figure 4, the embodiment of the invention provides a kind of picture and upload device.Device embodiment can be by soft Part is realized, it is also possible to realized by way of hardware or software and hardware combining.From for hardware view, as shown in figure 3, being this hair The picture that bright embodiment is provided uploads a kind of hardware structure diagram of equipment where device, except the processor shown in Fig. 3, internal memory, Outside network interface and nonvolatile memory, the equipment in embodiment where device can also generally include other hardware, Such as it is responsible for the forwarding chip for the treatment of message.As a example by implemented in software, as shown in figure 4, as the dress on a logical meaning Put, transported during corresponding computer program instructions in nonvolatile memory are read into internal memory by the CPU of equipment where it What row was formed.The picture that the present embodiment is provided uploads device, including:Loading unit 401, acquiring unit 402, encapsulation unit 403 And uploading unit 404;
The loading unit 401, for loading applet Applet in outside client;
The acquiring unit 402, for receiving the trigger event that the client conducts interviews to triggering WEB page, and Applet treatment classes are uploaded according to picture is obtained in the Applet that the trigger event is loaded from the loading unit 401; Wherein, the HTML html file code of the triggering WEB page includes that Applet is marked;
The encapsulation unit 403, the picture for being got by the acquiring unit 402 uploads Applet treatment Class, is packaged to the picture to be uploaded in the client;
The uploading unit 404, for the encapsulation unit 403 to be encapsulated by HTTP HTTP after institute State the server that uploading pictures are uploaded to outside.
In an embodiment of the invention, the loading unit 401 is used to access the client process of WEB page It is monitored, judges whether the client is access triggers WEB page first, if it is, obtains institute from the server Applet is stated, and the Applet is loaded into the client.
In an embodiment of the invention, the picture uploads device and can further include:Embedded unit 505;
Embedded unit 505, for being compiled to form Java to the Applet that the loading unit 401 is loaded Class files, and the Java class files are embedded into the triggering WEB page, trigger WEB page again with described The Applet is loaded into the client when being opened.
In an embodiment of the invention, the acquiring unit 402 includes:Obtain subelement;
The acquisition subelement, for being indexed in the Applet by name attribute, is obtained picture and uploaded Applet;It is indexed in the picture uploads Applet by store path attribute, obtains the Java uploaded for picture The path of archive file Jar bags;It is indexed in the path of the Jar bags by encoded attributes, obtains the picture and upload Applet processes class.
In an embodiment of the invention, the encapsulation unit 403 is used to call the picture to upload Applet treatment classes Picture upload method, create abstract class HttpURLConnection objects, by the HttpURLConnection objects Picture to be uploaded in the client is packaged.
The contents such as the information exchange between each unit, implementation procedure in said apparatus, due to implementing with the inventive method Example is based on same design, and particular content can be found in the narration in the inventive method embodiment, and here is omitted.
One embodiment of the invention additionally provides a kind of computer-readable recording medium, including execute instruction, when the treatment of storage control When device performs the execute instruction, the storage control performs the picture upload method that above-mentioned each embodiment is provided.
One embodiment of the invention additionally provides a kind of storage control, including:Processor, memory and bus;
The memory is used to store execute instruction, and the processor is connected with the memory by the bus, when When the storage control runs, the execute instruction of memory storage described in the computing device, so that the storage Controller performs the picture upload method that above-mentioned each embodiment is provided.
In sum, each embodiment of the invention is provided picture upload method and device, at least with following beneficial effect Really:
1st, in picture upload method provided in an embodiment of the present invention and device, after loading Applet on the client, when When client conducts interviews to the triggering WEB page for including Applet marks, obtained on picture from the Applet for being loaded Applet treatment classes are passed, picture uploads Applet treatment class and the picture to be uploaded in client can be packaged, Jin Erke With by HTTP by encapsulation after picture to be uploaded upload onto the server.As can be seen here, when client is carried out to triggering WEB page During access, if there are picture to be uploaded in client, upload Applet automatically by picture and process class to be uploaded Picture is packaged, and uploads onto the server, and picture upload procedure is manually operated without user, so as to improve the body of user Test.
2nd, in picture upload method provided in an embodiment of the present invention and device, html file generation is accessed first in client When code includes the triggering WEB page of Applet marks, download Applet from server and be loaded into client, in client On when there is picture to be uploaded, the picture included using Applet uploads Applet treatment class to be treated uploading pictures and is sealed Dress, and then on picture to be uploaded is uploaded onto the server.So, during client conducts interviews to triggering WEB page, often When occurring picture to be uploaded in client, picture to be uploaded can be uploaded onto the server automatically, and whole process need not Artificial operation, it is ensured that user has preferably experience.
3rd, in picture upload method provided in an embodiment of the present invention and device, Applet is being loaded into client it Afterwards, Applet is compiled by client and forms Java class files, and Java class files are embedded into triggering WEB In the page, when each client access html file code includes the triggering WEB page of Applet marks later, Applet is Can be run as triggering WEB page is loaded into client.So, after Applet is loaded into client, next time adjusts again Used time, without being loaded from server again, the time of Applet is re-downloaded from server due to saving, such that it is able to improve The speed that picture is uploaded.
4th, in picture upload method provided in an embodiment of the present invention and device, client image data correlation generation will be obtained Code is all encapsulated into ImageSave.jar, when picture upload Applet treatment classes are obtained, it is only necessary to introduce corresponding Jar bags Can be used in the page, with good ease for use and compatibility, so as to improve the picture that the embodiment of the present invention is provided The applicability of method for uploading.
5th, in picture upload method provided in an embodiment of the present invention and device, HttpURLConnection is many one kind Purposes, the HTTP clients of lightweight, it is adaptable to most application program, support caching function, with good ease for use And autgmentability, therefore, the picture upload method for calling picture to upload Applet treatment classes creates HttpURLConnection objects Afterwards, the method that uploading pictures are packaged is treated by HttpURLConnection objects, goes for treating for various forms Uploading pictures and various types of clients, further increase the applicability of the picture upload method.
It should be noted that herein, such as first and second etc relational terms are used merely to an entity Or operation makes a distinction with another entity or operation, and not necessarily require or imply these entities or exist between operating Any this actual relation or order.And, term " including ", "comprising" or its any other variant be intended to it is non- It is exclusive to include, so that process, method, article or equipment including a series of key elements not only include those key elements, But also other key elements including being not expressly set out, or also include by this process, method, article or equipment are solid Some key elements.In the absence of more restrictions, the key element limited by sentence " including ", does not arrange Except also there is other identical factor in the process including the key element, method, article or equipment.
One of ordinary skill in the art will appreciate that:Realizing all or part of step of above method embodiment can pass through Programmed instruction related hardware is completed, and foregoing program can be stored in the storage medium of embodied on computer readable, the program Upon execution, the step of including above method embodiment is performed;And foregoing storage medium includes:ROM, RAM, magnetic disc or light Disk etc. is various can be with the medium of store program codes.
It is last it should be noted that:Presently preferred embodiments of the present invention is the foregoing is only, skill of the invention is merely to illustrate Art scheme, is not intended to limit the scope of the present invention.All any modifications made within the spirit and principles in the present invention, Equivalent, improvement etc., are all contained in protection scope of the present invention.

Claims (10)

1. a kind of picture upload method, it is characterised in that applet Applet is loaded in outside client, is also wrapped Include:
The trigger event that the client conducts interviews to triggering WEB page is received, wherein, the super text of the triggering WEB page This markup language html file code includes that Applet is marked;
According to the trigger event, picture is obtained from the Applet and uploads Applet treatment classes;
Applet is uploaded by the picture and processes class, the picture to be uploaded in the client is packaged;
Picture described to be uploaded after HTTP HTTP is by encapsulation is uploaded to the server of outside.
2. method according to claim 1, it is characterised in that
The loading applet Applet in outside client, including:
The process that the client accesses WEB page is monitored;
Judge whether the client is access triggers WEB page first;
If it is, obtaining the Applet from the server, and the Applet is loaded into the client.
3. method according to claim 2, it is characterised in that
It is described the Applet is loaded into the client after, further include:
The Applet is compiled to form Java class files, and the Java class files are embedded into described touching Hair WEB page, the client is loaded into when the triggering WEB page is opened again by the Applet.
4. method according to claim 1, it is characterised in that
The picture that obtained from the Applet uploads Applet treatment classes, including:
It is indexed in the Applet by name attribute, obtains picture and upload Applet;
It is indexed in the picture uploads Applet by store path attribute, obtains the Java archive uploaded for picture The path of file Jar bags;
It is indexed in the path of the Jar bags by encoded attributes, obtains the picture and upload Applet treatment classes.
5. according to any described method in Claims 1-4, it is characterised in that
It is described the picture to be uploaded in the client is packaged by picture upload Applet treatment class, including:
Call the picture to upload the picture upload method that Applet processes class, create abstract class HttpURLConnection pairs As being packaged to the picture to be uploaded in the client by the HttpURLConnection objects.
6. a kind of picture uploads device, it is characterised in that including:Loading unit, acquiring unit, encapsulation unit and uploading unit;
The loading unit, for loading applet Applet in outside client;
The acquiring unit, for receiving the trigger event that the client conducts interviews to triggering WEB page, and according to described Trigger event obtains picture from the Applet that the loading unit is loaded and uploads Applet treatment classes;Wherein, it is described to touch Sending out the HTML html file code of WEB page includes that Applet is marked;
The encapsulation unit, the picture for being got by the acquiring unit uploads Applet treatment classes, to described Picture to be uploaded in client is packaged;
The uploading unit, for the uploading pictures after HTTP HTTP encapsulates the encapsulation unit It is uploaded to the server of outside.
7. device according to claim 6, it is characterised in that
Whether the loading unit, the process for accessing the client WEB page is monitored, and judges the client It is access triggers WEB page first, if it is, obtain the Applet from the server, and by Applet loadings Onto the client.
8. device according to claim 7, it is characterised in that further include:Embedded unit;
The embedded unit, Java class texts are formed for being compiled to the Applet that the loading unit is loaded Part, and the Java class files are embedded into the triggering WEB page, it is opened again with the triggering WEB page When the Applet is loaded into the client.
9. device according to claim 6, it is characterised in that
The acquiring unit includes:Obtain subelement;
The acquisition subelement, for being indexed in the Applet by name attribute, is obtained picture and uploads Applet; It is indexed in the picture uploads Applet by store path attribute, obtains the Java archive file uploaded for picture The path of Jar bags;It is indexed in the path of the Jar bags by encoded attributes, obtains the picture and upload at Applet Reason class.
10. according to any described device in claim 6 to 9, it is characterised in that
The encapsulation unit, for calling the picture to upload the picture upload method that Applet processes class, creates abstract class HttpURLConnection objects, by the HttpURLConnection objects to the picture to be uploaded in the client It is packaged.
CN201710131406.7A 2017-03-07 2017-03-07 A kind of picture upload method and device Pending CN106936904A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710131406.7A CN106936904A (en) 2017-03-07 2017-03-07 A kind of picture upload method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710131406.7A CN106936904A (en) 2017-03-07 2017-03-07 A kind of picture upload method and device

Publications (1)

Publication Number Publication Date
CN106936904A true CN106936904A (en) 2017-07-07

Family

ID=59423475

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710131406.7A Pending CN106936904A (en) 2017-03-07 2017-03-07 A kind of picture upload method and device

Country Status (1)

Country Link
CN (1) CN106936904A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109660588A (en) * 2018-10-25 2019-04-19 深圳壹账通智能科技有限公司 Picture upload method, device and storage medium, terminal
CN109819014A (en) * 2018-12-14 2019-05-28 平安普惠企业管理有限公司 Project dispositions method, device, computer equipment and storage medium
CN109948123A (en) * 2018-11-27 2019-06-28 阿里巴巴集团控股有限公司 A kind of image combining method and device
CN112532730A (en) * 2020-12-01 2021-03-19 四川虹美智能科技有限公司 Picture uploading system and method

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030065609A1 (en) * 2001-09-28 2003-04-03 Oh Kyongkun Method and system for providing real-time data transmission for securities trading
US20090204721A1 (en) * 2008-02-12 2009-08-13 Danger, Inc. System and method for copying data onto an expandable memory in a wireless device using a desktop interface
CN101854395A (en) * 2010-06-02 2010-10-06 四川华廷威思信息技术有限公司 Automatic attachment modifying method based on Web program
CN102185882A (en) * 2011-03-09 2011-09-14 中山大学 Method and device for remotely monitoring embedded physiological information
CN102495677A (en) * 2011-11-23 2012-06-13 浪潮电子信息产业股份有限公司 Method for realizing KVM (kernel-based virtual machine) over IP (internet protocol) through WEB page

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030065609A1 (en) * 2001-09-28 2003-04-03 Oh Kyongkun Method and system for providing real-time data transmission for securities trading
US20090204721A1 (en) * 2008-02-12 2009-08-13 Danger, Inc. System and method for copying data onto an expandable memory in a wireless device using a desktop interface
CN101854395A (en) * 2010-06-02 2010-10-06 四川华廷威思信息技术有限公司 Automatic attachment modifying method based on Web program
CN102185882A (en) * 2011-03-09 2011-09-14 中山大学 Method and device for remotely monitoring embedded physiological information
CN102495677A (en) * 2011-11-23 2012-06-13 浪潮电子信息产业股份有限公司 Method for realizing KVM (kernel-based virtual machine) over IP (internet protocol) through WEB page

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
《网络整理》: "《如何实现文件自动上传》", 《HTTP://WWW.CODES51.COM/ITWD/2151191.HTML》 *

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109660588A (en) * 2018-10-25 2019-04-19 深圳壹账通智能科技有限公司 Picture upload method, device and storage medium, terminal
CN109660588B (en) * 2018-10-25 2023-05-30 深圳壹账通智能科技有限公司 Picture uploading method and device, storage medium and terminal
CN109948123A (en) * 2018-11-27 2019-06-28 阿里巴巴集团控股有限公司 A kind of image combining method and device
CN109948123B (en) * 2018-11-27 2023-06-02 创新先进技术有限公司 Image merging method and device
CN109819014A (en) * 2018-12-14 2019-05-28 平安普惠企业管理有限公司 Project dispositions method, device, computer equipment and storage medium
CN109819014B (en) * 2018-12-14 2022-10-25 平安普惠企业管理有限公司 Project deployment method and device, computer equipment and storage medium
CN112532730A (en) * 2020-12-01 2021-03-19 四川虹美智能科技有限公司 Picture uploading system and method
CN112532730B (en) * 2020-12-01 2022-09-20 四川虹美智能科技有限公司 Picture uploading system and method

Similar Documents

Publication Publication Date Title
CN106936904A (en) A kind of picture upload method and device
US8819819B1 (en) Method and system for automatically obtaining webpage content in the presence of javascript
US8620995B2 (en) Method, computer program, transcoding server and computer system for modifying a digital document
CN101222349B (en) Method and system for collecting web user action and performance data
EP0889420A2 (en) Media manager for access to multiple media types
CN109361731A (en) A kind of method, storage medium and server that file uploads
TWI354475B (en) Dispatching client requests to appropriate server-
CN107040584B (en) Method and device for downloading picture by client
CN107315646B (en) Method and device for controlling data flow between page components
CN108196829A (en) A kind of artificial intelligence mobile phone accounting system for analyzing account and method
CN107798064A (en) Page processing method, electronic equipment and computer-readable recording medium
CN106599270A (en) Network data capturing method and crawler
CN109725887B (en) Data interaction method and device based on message research and development framework and terminal equipment
CN111651140A (en) Service method and device based on workflow
CN109343908B (en) Method and device for delaying loading of JS script
CN104123143A (en) User control loading system and method
WO2011137683A2 (en) Method and device for web application hosting
CN102681996B (en) Pre-head method and device
CN107770377A (en) A kind of method of the establishment interactive voice mobile phone news client based on HTML5
CN108170414A (en) A kind of establishment can voice, collaboration and the artificial intelligence of analysis accounting system method
US20080263140A1 (en) Network System, Server, Client, Program and Web Browsing Function Enabling Method
CN109947751A (en) A kind of medical data processing method, device, readable medium and electronic equipment
CN112579960A (en) Webpage evidence obtaining method, webpage evidence obtaining device and server
CN108255469A (en) A kind of establishment can voice and analysis account artificial intelligence accounting system method
CN108279900A (en) A method of artificial smart mobile phone accounting system is created based on HTML5

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20170707

RJ01 Rejection of invention patent application after publication