CN117216433A - Multi-format file online previewing method, equipment and medium for webpage end - Google Patents

Multi-format file online previewing method, equipment and medium for webpage end Download PDF

Info

Publication number
CN117216433A
CN117216433A CN202311180180.1A CN202311180180A CN117216433A CN 117216433 A CN117216433 A CN 117216433A CN 202311180180 A CN202311180180 A CN 202311180180A CN 117216433 A CN117216433 A CN 117216433A
Authority
CN
China
Prior art keywords
file
path address
format
server
preview
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
CN202311180180.1A
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.)
Langchao Gongchuang Shandong Supply Chain Technology Co ltd
Original Assignee
Langchao Gongchuang Shandong Supply Chain Technology 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 Langchao Gongchuang Shandong Supply Chain Technology Co ltd filed Critical Langchao Gongchuang Shandong Supply Chain Technology Co ltd
Priority to CN202311180180.1A priority Critical patent/CN117216433A/en
Publication of CN117216433A publication Critical patent/CN117216433A/en
Pending legal-status Critical Current

Links

Landscapes

  • Information Transfer Between Computers (AREA)

Abstract

The application discloses a multi-format file online previewing method, equipment and medium aiming at a webpage end, wherein the method comprises the following steps: receiving a binary file stream uploaded by a client, and calling an interface to a file server; receiving file information for a file returned by a file server; returning the file information to the client; receiving an online preview viewing request for a file initiated by a client, calling an interface of a file server, sending a relative path address to the file server, and generating a temporary absolute path address of the file at the current time by the file server according to the relative path address; receiving response information returned by the file server; the response information comprises file names, file types and absolute path addresses of the files; intercepting the suffix of the absolute path address, and determining the file format of the file according to the suffix; querying a file preview strategy of a file format; and displaying the file on line according to the file preview strategy and the response information. And the online preview efficiency is improved rapidly.

Description

Multi-format file online previewing method, equipment and medium for webpage end
Technical Field
The present application relates to the field of computer technologies, and in particular, to a method, an apparatus, and a medium for online previewing of multiple format files on a web page end.
Background
In the mainstream business process and business development, there are relatively many treaty documents, other attachments, uploading of document files, etc., and these document files may be in various file formats, such as pictures, pdf, word, excel, etc.
At present, when a webpage of a client is viewed, a part of the webpage is viewed by clicking a file link to download the file. However, when the traffic volume is complex and the number of business files is too large, downloading and viewing of each file is time-consuming, the user experience of the system is also greatly reduced, and the downloaded files occupy a large amount of local memory space. The other part is the explanation aiming at the online preview of single file types, and under the condition of more viewing requirements of multiple file formats in the current actual service, developers need to practice each file type one by one and then gather the files for use, so that the development practice difficulty is high, and the online preview efficiency is low.
Therefore, a more efficient technical solution for online previewing of multi-format files is needed.
Disclosure of Invention
The embodiment of the application provides a method, equipment and medium for online previewing of a multi-format file aiming at a webpage end, which are used for solving the problem that a technical scheme for online previewing of the multi-format file with higher efficiency is needed.
The embodiment of the application adopts the following technical scheme:
on one hand, the embodiment of the application provides a method for receiving a binary file stream uploaded by a client, and calling an API (application program interface) according to the binary file stream; receiving file information which is returned by the file server and is specific to a file, wherein the file information comprises a relative path address, a temporary absolute path address and a file name of the file; returning the file information to the client; receiving an online preview viewing request for the file initiated by a client, calling an API interface of the file server, and sending the relative path address to the file server, so that the file server generates a temporary absolute path address of the file at the current time according to the relative path address; receiving response information returned by the file server; the response information comprises a file name, a file type and the absolute path address of the file; intercepting the suffix of the absolute path address, and determining the file format of the file according to the suffix; inquiring a file preview strategy corresponding to the file format; and displaying the file on line according to the file preview strategy and the response information on the web page of the client.
In one example, after the calling the API according to the binary file stream to the file server, the method further includes: the file server generates a relative path address for a file according to a binary file stream and file information containing the relative path address; the file information is sent to the service server for the first time; judging whether feedback information of the business server is received or not within a preset duration; the feedback information is used for indicating whether the business server receives the file information; if not, the file information is sent to the service server for the second time; and if the feedback information of the business server is not received for the second time within the preset time, generating abnormal notification information, and sending the abnormal notification information to a management user terminal.
In one example, the method for generating, by the file server, a temporary absolute path address of the file at the current time according to the relative path address specifically includes: the file server matches the relative path address in a file database; if the matching is successful, generating a temporary absolute path address of the file at the current time; the suffix of the absolute path address includes a current timestamp.
In one example, before the querying the file preview policy corresponding to the file format, the method further includes: determining a plurality of sample file formats; the sample file format comprises a picture type, a PDF type, a word document type and an excel document type; constructing a file preview strategy corresponding to each sample file format; establishing a mapping relation between each sample file format and a corresponding file preview strategy so as to construct a file preview strategy mapping relation table; querying a file preview strategy corresponding to the file format, wherein the method specifically comprises the following steps: matching the file formats in the file preview strategy mapping relation table to obtain matched file formats; and obtaining the file preview strategy according to the matched file format.
In one example, the file format is a picture type, and the displaying the file on line according to the file preview policy and the response information specifically includes: setting the src attribute of the img tag as the absolute path address so as to call the file to the file server; and displaying the file in a picture format based on the response information.
In one example, the file format is pdf type, and the displaying the file according to the file preview policy and the response information specifically includes: acquiring a file page number of the file; setting the src attribute of the pre-constructed pdf component as the absolute path address so as to call the file to the file server; and displaying the file in a PDF format based on the response information, and performing page turning preview on the file according to the PDF component and the file page number.
In one example, the file format is of a word type, and the displaying the file according to the file preview policy and the response information specifically includes: calling the file to the file server according to the absolute path address, and converting the file into a file in a type array format with preset digits; and inputting a conversion to Html method provided by a mammoth plug-in by taking the file in the type array format with the preset digits as an input parameter, converting the file into Html resources, and displaying the file in a word format according to the response information.
In one example, the file format is an excel type, and the displaying the file according to the file preview policy and the response information specifically includes: calling the file to the file server according to the absolute path address, and converting the file into a file in a type array format with preset digits according to an xlsx plug-in; analyzing the file in the type array format of the preset bit number to obtain file content; and displaying the file content in an excel format of the client according to the online form component and the response information.
On the other hand, the embodiment of the application provides a multi-format file online previewing device for a webpage end, which is applied to a business server end and comprises the following steps: at least one processor; and a memory communicatively coupled to the at least one processor; wherein the memory stores instructions executable by the at least one processor to enable the at least one processor to: receiving a binary file stream uploaded by a client, and calling an API (application program interface) according to the binary file stream; receiving file information which is returned by the file server and is specific to a file, wherein the file information comprises a relative path address, a temporary absolute path address and a file name of the file; returning the file information to the client; receiving an online preview viewing request for the file initiated by a client, calling an API interface of the file server, and sending the relative path address to the file server, so that the file server generates a temporary absolute path address of the file at the current time according to the relative path address; receiving response information returned by the file server; the response information comprises a file name, a file type and the absolute path address of the file; intercepting the suffix of the absolute path address, and determining the file format of the file according to the suffix; inquiring a file preview strategy corresponding to the file format; and displaying the file on line according to the file preview strategy and the response information on the web page of the client.
In another aspect, an embodiment of the present application provides an online previewing method for a multi-format file on a web page, where the online previewing method includes: receiving a binary file stream uploaded by a client, and calling an API (application program interface) according to the binary file stream; receiving file information which is returned by the file server and is specific to a file, wherein the file information comprises a relative path address, a temporary absolute path address and a file name of the file; returning the file information to the client; receiving an online preview viewing request for the file initiated by a client, calling an API interface of the file server, and sending the relative path address to the file server, so that the file server generates a temporary absolute path address of the file at the current time according to the relative path address; receiving response information returned by the file server; the response information comprises a file name, a file type and the absolute path address of the file; intercepting the suffix of the absolute path address, and determining the file format of the file according to the suffix; inquiring a file preview strategy corresponding to the file format; and displaying the file on line according to the file preview strategy and the response information on the web page of the client.
The above at least one technical scheme adopted by the embodiment of the application can achieve the following beneficial effects:
the file information of the file returned by the file server is received, so that when an online preview viewing request of the file initiated by the client is received, a temporary absolute path address of the file at the current time is generated through the file server, no matter which file format is, so that the file can be matched with a corresponding file preview policy in a plurality of pre-constructed file preview policies, and the file can be displayed online based on the file preview policy. Compared with file viewing methods such as downloading and storing, the method can greatly improve viewing efficiency and greatly improve user viewing experience. Compared with the online preview method only supporting the files with the single format, the online preview method only uses a small amount of codes to realize the function of supporting the online previews of the files with the multiple formats, and can rapidly improve the online preview efficiency.
Drawings
In order to more clearly illustrate the technical solution of the present application, some embodiments of the present application will be described in detail below with reference to the accompanying drawings, in which:
fig. 1 is a flow chart of a multi-format file online previewing method for a web page end according to an embodiment of the present application;
fig. 2 is a schematic structural diagram of a multi-format file online previewing device for a web page according to an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the technical solutions of the present application will be clearly and completely described below with reference to specific embodiments and corresponding drawings. It will be apparent that the described embodiments are only some, but not all, embodiments of the application. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
Some embodiments of the present application are described in detail below with reference to the accompanying drawings.
Fig. 1 is a flow chart of an online previewing method for a multi-format file at a web page end according to an embodiment of the present application. The method can be applied to different business fields, such as the internet financial business field, the electric business field, the instant messaging business field, the game business field, the public business field and the like. Some of the input parameters or intermediate results in the flow allow for manual intervention adjustments to help improve accuracy.
The flow in fig. 1 may include the steps of:
s101: and the service server receives the binary file stream uploaded by the client and calls an API interface according to the binary file stream.
And uploading the file by the user in the interface of the client, so that the client uploads the binary file stream to the service server.
S102: receiving file information which is returned by the file server and is specific to a file, wherein the file information comprises a relative path address, a temporary absolute path address and a file name of the file; and returning the file information to the client.
In some embodiments of the present application, after the service server uploads the binary file stream to the file server, the file server generates a relative path address and file information including the relative path address for the file according to the binary file stream.
It should be noted that, the file server side stores the file and the file information of the file into the file database.
And then, the file information is sent to the service server, so that the service server receives the file information for the file returned by the file server.
It should be noted that, when the file server sends the file information to the service server, there is a possibility that the file server fails to send, for example, the transmission network is interrupted, or the service server fails, or the file server fails.
Based on the information, the business server receives the file information of the file returned by the file server and sends feedback information of successful receiving to the file server.
Therefore, after the file server sends the file information to the service server for the first time, whether feedback information of the service server is received is judged within a preset duration. The feedback information is used for indicating whether the service server receives the file information.
If yes, the second transmission is not performed. If not, the file information is sent to the service server for the second time.
And if the feedback information of the service server is not received for the second time within the preset time, generating abnormal notification information, and sending the abnormal notification information to the management user terminal. If the feedback information of the service server is received for the second time, the abnormal notification information is not generated.
S103: and receiving an online preview viewing request for the file initiated by a client, calling an API interface of the file server, and sending the relative path address to the file server, so that the file server generates a temporary absolute path address of the file at the current time according to the relative path address.
In some embodiments of the present application, when generating a temporary absolute path address of a file at a current time, when the file server is called an API interface, the relative path address is matched in the file database.
If the matching is successful, a temporary absolute path address of the file at the current time is generated. Wherein the suffix of the absolute path address comprises the current timestamp. In addition, response information for the file returned to the service server is also generated.
The absolute path address is related to the generation time. If it is the absolute path address of the file that has a time before the current time, it is considered as the failed absolute path address.
That is, since the relative path address of the file at the service end may be tampered, after being tampered, the same relative path address cannot be found in the file database. Therefore, by matching the relative path addresses, the security of the file can be improved.
Based on the above, if the matching fails, call failure notification information is returned to the service server.
S104: receiving response information returned by the file server; the response information includes a file name, a file type, and the absolute path address of the file.
S105: and intercepting the suffix of the absolute path address, and determining the file format of the file according to the suffix.
That is, the absolute path address suffix includes a file format, and furthermore, the file can be previewed on the browser web page of the client only after the absolute path address of the file is obtained.
S106: and inquiring a file preview strategy corresponding to the file format.
In some embodiments of the present application, it is desirable to pre-construct file preview policies in multiple file formats, each of which is independent and mutually exclusive.
Specifically, a plurality of sample file formats are determined. The sample file format comprises a picture type, a PDF type, a word document type and an excel document type.
And constructing a file preview strategy corresponding to each sample file format.
And establishing a mapping relation between each sample file format and the corresponding file preview strategy so as to construct a file preview strategy mapping relation table.
Based on the file preview policy corresponding to the query file format, the method specifically comprises the following steps:
and matching the file formats in the file preview strategy mapping relation table to obtain matched file formats. And then, obtaining a file preview strategy according to the matched file format.
S107: and displaying the file on line according to the file preview strategy and the response information on the web page of the client.
Based on this, when the file format is a picture type, the src attribute of the img tag is set as an absolute path address to call the file to the file server. Then, the file is displayed in a picture format based on the response information.
And when the file format is pdf type, acquiring the file page number of the file. Then, the src attribute of the pre-built pdf component is set to an absolute path address to call the file to the file server. For example, the pdf component is a component provided based on vue-pdf-signature-5. And finally, displaying the file in a PDF format based on the response information, and turning pages to preview the file according to the PDF component and the page number of the file.
When the file format is word type, calling the file to the file server according to the absolute path address, and converting the file into the file with the type array format with the preset number of bits. For example, the input parameters need to be in an 8-bit type array file format. The type array format is an arrayBuffer format.
The method includes the steps that a file in a type array format with a preset number of bits is used as an input parameter, a conversion to Html method provided by a mammoth plug-in is input, the file is converted into Html resources, and the file is displayed in a word format according to response information.
When the file format is excel type, calling the file to the file server according to the absolute path address, and converting the file into the file with the type array format with the preset number of bits according to the xlsx plug-in. And then, analyzing the file in the type array format with the preset bit number to obtain the file content. And finally, displaying the file content in an excel format of the client according to the online form component and the response information.
It should be noted that, the form of the file may be changed to an excel format template of the client, but the content of the file is unchanged
It should be noted that, if the file information is temporarily uploaded and temporarily checked by the client, the file information does not need to be saved in the database of the service server.
However, in the case where the client is required to preview online for viewing in order to facilitate the next business operation or view a file or other user can click on the other client, the save button is clicked so that the business server saves the relative path to its own database.
When other clients click on the page to view, the service server can go to the database to inquire the corresponding relative file path and return to other clients. Other clients take the relative file path and display the file name.
When the other clients click to view again, a request is sent to the service server again, the service server invokes the file method of the file server, and an absolute path is returned to the other clients for display.
It should be noted that, although the embodiment of the present application is described with reference to fig. 1 to sequentially describe steps S101 to S107, this does not represent that steps S101 to S107 must be performed in strict order. The steps S101 to S107 are sequentially described according to the sequence shown in fig. 1 in order to facilitate the understanding of the technical solution of the embodiment of the present application by those skilled in the art. In other words, in the embodiment of the present application, the sequence between the steps S101 to S107 may be appropriately adjusted according to the actual needs.
By the method of fig. 1, file information for a file returned by a file server is received, so that when an online preview viewing request for the file initiated by a client is received, a temporary absolute path address of the file at the current time can be generated by the file server, no matter which file format is, so that a plurality of pre-constructed file preview strategies can be matched with corresponding file preview strategies, and the file can be displayed online based on the file preview strategies. Compared with file viewing methods such as downloading and storing, the method can greatly improve viewing efficiency and greatly improve user viewing experience. Compared with the online preview method only supporting the files with the single format, the online preview method only uses a small amount of codes to realize the function of supporting the online previews of the files with the multiple formats, and can rapidly improve the online preview efficiency.
Based on the same thought, some embodiments of the present application also provide a device and a non-volatile computer storage medium corresponding to the above method.
Fig. 2 is a schematic structural diagram of a multi-format file online previewing device for a web page end, which is provided by an embodiment of the present application and is applied to a service end, where the device includes:
at least one processor; the method comprises the steps of,
a memory communicatively coupled to the at least one processor; wherein,
the memory stores instructions executable by the at least one processor to enable the at least one processor to:
receiving a binary file stream uploaded by a client, and calling an API (application program interface) according to the binary file stream;
receiving file information which is returned by the file server and is specific to a file, wherein the file information comprises a relative path address, a temporary absolute path address and a file name of the file; returning the file information to the client;
receiving an online preview viewing request for the file initiated by a client, calling an API interface of the file server, and sending the relative path address to the file server, so that the file server generates a temporary absolute path address of the file at the current time according to the relative path address;
receiving response information returned by the file server; the response information comprises a file name, a file type and the absolute path address of the file;
intercepting the suffix of the absolute path address, and determining the file format of the file according to the suffix;
inquiring a file preview strategy corresponding to the file format;
and displaying the file on line according to the file preview strategy and the response information on the web page of the client.
Some embodiments of the present application provide a multi-format file online previewing non-volatile computer storage medium for a web page end, storing computer executable instructions applied to a service end, where the computer executable instructions are configured to:
receiving a binary file stream uploaded by a client, and calling an API (application program interface) according to the binary file stream;
receiving file information which is returned by the file server and is specific to a file, wherein the file information comprises a relative path address, a temporary absolute path address and a file name of the file; returning the file information to the client;
receiving an online preview viewing request for the file initiated by a client, calling an API interface of the file server, and sending the relative path address to the file server, so that the file server generates a temporary absolute path address of the file at the current time according to the relative path address;
receiving response information returned by the file server; the response information comprises a file name, a file type and the absolute path address of the file;
intercepting the suffix of the absolute path address, and determining the file format of the file according to the suffix;
inquiring a file preview strategy corresponding to the file format;
and displaying the file on line according to the file preview strategy and the response information on the web page of the client.
The embodiments of the present application are described in a progressive manner, and the same and similar parts of the embodiments are all referred to each other, and each embodiment is mainly described in the differences from the other embodiments. In particular, for the apparatus and medium embodiments, the description is relatively simple, as it is substantially similar to the method embodiments, with reference to the section of the method embodiments being relevant.
The devices and media provided in the embodiments of the present application are in one-to-one correspondence with the methods, so that the devices and media also have similar beneficial technical effects as the corresponding methods, and since the beneficial technical effects of the methods have been described in detail above, the beneficial technical effects of the devices and media are not repeated here.
It will be appreciated by those skilled in the art that embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In one typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include volatile memory in a computer-readable medium, random Access Memory (RAM) and/or nonvolatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). Memory is an example of computer-readable media.
Computer readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of storage media for a computer include, but are not limited to, phase change memory (PRAM), static Random Access Memory (SRAM), dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), read Only Memory (ROM), electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium, which can be used to store information that can be accessed by a computing device. Computer-readable media, as defined herein, does not include transitory computer-readable media (transmission media), such as modulated data signals and carrier waves.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article or apparatus that comprises the element.
The foregoing is merely exemplary of the present application and is not intended to limit the present application. Various modifications and variations of the present application will be apparent to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the technical principle of the present application should fall within the protection scope of the present application.

Claims (10)

1. An online preview method for a multi-format file at a web page end is characterized by comprising the following steps:
the service server receives the binary file stream uploaded by the client and calls an API interface according to the binary file stream;
receiving file information which is returned by the file server and is specific to a file, wherein the file information comprises a relative path address, a temporary absolute path address and a file name of the file; returning the file information to the client;
receiving an online preview viewing request for the file initiated by a client, calling an API interface of the file server, and sending the relative path address to the file server, so that the file server generates a temporary absolute path address of the file at the current time according to the relative path address;
receiving response information returned by the file server; the response information comprises a file name, a file type and the absolute path address of the file;
intercepting the suffix of the absolute path address, and determining the file format of the file according to the suffix;
inquiring a file preview strategy corresponding to the file format;
and displaying the file on line according to the file preview strategy and the response information on the web page of the client.
2. The method of claim 1, wherein after the calling the API according to the binary file stream to the file server, the method further comprises:
the file server generates a relative path address for a file according to a binary file stream and file information containing the relative path address; the file information is sent to the service server for the first time;
judging whether feedback information of the business server is received or not within a preset duration; the feedback information is used for indicating whether the business server receives the file information;
if not, the file information is sent to the service server for the second time;
and if the feedback information of the business server is not received for the second time within the preset time, generating abnormal notification information, and sending the abnormal notification information to a management user terminal.
3. The method of claim 2, wherein the step of generating, by the file server, a temporary absolute path address of the file at the current time according to the relative path address specifically includes:
the file server matches the relative path address in a file database;
if the matching is successful, generating a temporary absolute path address of the file at the current time; the suffix of the absolute path address includes a current timestamp.
4. The method of claim 1, wherein prior to querying the file preview policy corresponding to the file format, the method further comprises:
determining a plurality of sample file formats; the sample file format comprises a picture type, a PDF type, a word document type and an excel document type;
constructing a file preview strategy corresponding to each sample file format;
establishing a mapping relation between each sample file format and a corresponding file preview strategy so as to construct a file preview strategy mapping relation table;
querying a file preview strategy corresponding to the file format, wherein the method specifically comprises the following steps:
matching the file formats in the file preview strategy mapping relation table to obtain matched file formats;
and obtaining the file preview strategy according to the matched file format.
5. The method of claim 4, wherein the file format is a picture type, and the displaying the file on line according to the file preview policy and the response information specifically includes:
setting the src attribute of the img tag as the absolute path address so as to call the file to the file server;
and displaying the file in a picture format based on the response information.
6. The method of claim 4, wherein the file format is pdf type, and the displaying the file according to the file preview policy and the response information specifically includes:
acquiring a file page number of the file;
setting the src attribute of the pre-constructed pdf component as the absolute path address so as to call the file to the file server;
and displaying the file in a PDF format based on the response information, and performing page turning preview on the file according to the PDF component and the file page number.
7. The method of claim 4, wherein the file format is word type, and the displaying the file according to the file preview policy and the response information specifically includes:
calling the file to the file server according to the absolute path address, and converting the file into a file in a type array format with preset digits;
and inputting a conversion to Html method provided by a mammoth plug-in by taking the file in the type array format with the preset digits as an input parameter, converting the file into Html resources, and displaying the file in a word format according to the response information.
8. The method of claim 4, wherein the file format is an excel type, and the displaying the file according to the file preview policy and the response information specifically includes:
calling the file to the file server according to the absolute path address, and converting the file into a file in a type array format with preset digits according to an xlsx plug-in;
analyzing the file in the type array format of the preset bit number to obtain file content;
and displaying the file content in an excel format of the client according to the online form component and the response information.
9. The multi-format file online previewing device for the webpage end is characterized by being applied to a business service end and comprising the following components:
at least one processor; the method comprises the steps of,
a memory communicatively coupled to the at least one processor; wherein,
the memory stores instructions executable by the at least one processor to enable the at least one processor to:
receiving a binary file stream uploaded by a client, and calling an API (application program interface) according to the binary file stream;
receiving file information which is returned by the file server and is specific to a file, wherein the file information comprises a relative path address, a temporary absolute path address and a file name of the file; returning the file information to the client;
receiving an online preview viewing request for the file initiated by a client, calling an API interface of the file server, and sending the relative path address to the file server, so that the file server generates a temporary absolute path address of the file at the current time according to the relative path address;
receiving response information returned by the file server; the response information comprises a file name, a file type and the absolute path address of the file;
intercepting the suffix of the absolute path address, and determining the file format of the file according to the suffix;
inquiring a file preview strategy corresponding to the file format;
and displaying the file on line according to the file preview strategy and the response information on the web page of the client.
10. A non-volatile computer storage medium for online previewing of multi-format files for a web page, storing computer executable instructions, characterized in that the computer executable instructions are applied to a business server, and the computer executable instructions are configured to:
receiving a binary file stream uploaded by a client, and calling an API (application program interface) according to the binary file stream;
receiving file information which is returned by the file server and is specific to a file, wherein the file information comprises a relative path address, a temporary absolute path address and a file name of the file; returning the file information to the client;
receiving an online preview viewing request for the file initiated by a client, calling an API interface of the file server, and sending the relative path address to the file server, so that the file server generates a temporary absolute path address of the file at the current time according to the relative path address;
receiving response information returned by the file server; the response information comprises a file name, a file type and the absolute path address of the file;
intercepting the suffix of the absolute path address, and determining the file format of the file according to the suffix;
inquiring a file preview strategy corresponding to the file format;
and displaying the file on line according to the file preview strategy and the response information on the web page of the client.
CN202311180180.1A 2023-09-13 2023-09-13 Multi-format file online previewing method, equipment and medium for webpage end Pending CN117216433A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311180180.1A CN117216433A (en) 2023-09-13 2023-09-13 Multi-format file online previewing method, equipment and medium for webpage end

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311180180.1A CN117216433A (en) 2023-09-13 2023-09-13 Multi-format file online previewing method, equipment and medium for webpage end

Publications (1)

Publication Number Publication Date
CN117216433A true CN117216433A (en) 2023-12-12

Family

ID=89043703

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311180180.1A Pending CN117216433A (en) 2023-09-13 2023-09-13 Multi-format file online previewing method, equipment and medium for webpage end

Country Status (1)

Country Link
CN (1) CN117216433A (en)

Similar Documents

Publication Publication Date Title
RU2471227C2 (en) Peer-to-peer synchronisation assisted with service unit
CN111736775B (en) Multi-source storage method, device, computer system and storage medium
US20220191203A1 (en) Methods and apparatus for establishing shared memory spaces for data access and distribution
CN110263001B (en) File management method, device, system, equipment and computer readable storage medium
CN109257451B (en) Corresponding relation analysis method and equipment
EP3928496A1 (en) Server-based segmentation of subscriber information and content format conversion for targeted content provision
CN107864208B (en) Method for fusing new media information
CN108021564B (en) Method and equipment for redirecting page
JP2004310371A (en) System, method, server for sharing file and client terminal for file sharing service, file sharing program and recording medium with program recorded
DE602005005435T2 (en) System and method for communication management of component applications
US9665732B2 (en) Secure Download from internet marketplace
CN114528813A (en) File conversion management method, device, equipment and medium for online preview
CN104978325A (en) Webpage processing method and device, and user terminal
CN110677443A (en) Data transmitting and receiving method, transmitting end, receiving end, system and storage medium
CN112256696A (en) Form data processing method, device, equipment and storage medium
CN117216433A (en) Multi-format file online previewing method, equipment and medium for webpage end
CN112579694A (en) Digital resource processing method, device, storage medium and equipment
CN107103001B (en) Method, device and system for acquiring target front-end resource file based on browser
CN113342772A (en) Cloud storage method, equipment and medium capable of being locally deployed
CN113590234A (en) Method, device and equipment for automatically acquiring data and storage medium
CN114745146A (en) Skip interception method and device, readable storage medium and equipment
CN110740046A (en) Method and device for analyzing service contract
CN113377867B (en) Data synchronization method and device and electronic equipment
CN112448931B (en) Network hijacking monitoring method and device
US20230247081A1 (en) Declarative rendering of hypertext transfer protocol headers

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