File upload method and device
By calling the target plug-in in the file upload tag to determine the type of object to be uploaded, and using a dynamic scripting language program to obtain and upload network files, the problem that the web file upload function is difficult to meet user needs, and the development efficiency is improved.
Patent Information
- Application Number
- CN202211467523.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-22
- Publication Date
- 2025-02-11
- Estimated Expiration
- 2042-11-22
AI Technical Summary
In the prior art, the file upload function provided by web pages is difficult to meet the user's functional and aesthetic needs, resulting in developers needing to repeatedly modify the code and reduce work efficiency.
By calling the target plug-in in the file upload tag, we judge the type of the object to be uploaded, and when the object to be uploaded is a network address, we use a preloaded dynamic scripting language program to obtain and upload network files.
It effectively reduces the situation where front-end developers repeatedly modify code because the file upload function cannot meet user needs, improves work efficiency, and solves the problem that the file upload function provided by the web page is difficult to meet user needs.
Smart Images

Figure CN115865894B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of front-end development technology, and in particular to a file uploading method and device. Background Art
[0002] Currently, with the rapid development of Internet technology, users' demands for the technical or aesthetics of file upload functions or application scenarios provided by web pages are also constantly increasing.
[0003] Therefore, relevant developers usually adopt more complicated detours to achieve the ultimate technical and aesthetic goals, but the whole process requires developers to spend a lot of time thinking about various complicated methods, resulting in a sharp drop in their work efficiency and affecting the progress of project development.
[0004] To address the above-mentioned problems, no effective solution has been proposed yet. Summary of the invention
[0005] The embodiments of the present application provide a file uploading method and device to at least solve the technical problem in the related art that the file uploading function provided by the web page is difficult to meet the user's needs.
[0006] According to one aspect of an embodiment of the present application, a file uploading method is provided, comprising: when detecting that an object to be uploaded is input in a file upload tag, calling a target plug-in to determine the type of the object to be uploaded; when the object to be uploaded is a network address, calling the target plug-in to obtain a network file stored in the network address, wherein the target plug-in includes a preloaded first dynamic scripting language program, and the first dynamic scripting language program is used to obtain the network file stored in the network address; uploading the network file to a database in a backend server.
[0007] Optionally, before calling the target plug-in to determine the object type of the object to be uploaded, the method further includes: loading the first dynamic scripting language program into the target plug-in; binding the function of calling the target plug-in to the attribute of the file upload tag, and initializing the target plug-in.
[0008] Optionally, calling the target plug-in to obtain the network file stored in the network address includes: executing a first dynamic scripting language program in the target plug-in to obtain the network file from the network address; and storing the network file in a file upload tag.
[0009] Optionally, the target plug-in also includes a preloaded second dynamic script language program for detecting the file size. After obtaining the network file from the network address, it also includes: executing the second dynamic script language program in the target plug-in to detect the size of the network file; when the size of the network file is not greater than a preset threshold, storing the network file in a file upload tag; when the size of the network file is greater than the preset threshold, generating a first alarm message, the first alarm message being used to prompt that the network file is too large to be uploaded.
[0010] Optionally, the target plug-in also includes a preloaded third dynamic scripting language program for detecting the security of files. After obtaining the network file from the network address, it also includes: executing the third dynamic scripting language program in the target plug-in, detecting the security of the network file, and obtaining a detection result; when the detection result is that the network file is safe, storing the network file in a file upload tag; when the detection result is that there is an abnormality in the network file, generating a second alarm information, and the second alarm information is used to prompt that the network file is abnormal and cannot be uploaded.
[0011] Optionally, the target plug-in also includes multiple preloaded cascading style sheet files, and also includes: in response to a switching instruction for switching the tag style of the file upload tag, generating preview images of multiple tag styles corresponding to multiple cascading style sheets, and displaying the preview images of multiple tag styles; in response to a selected target preview image, adjusting the tag style of the file upload tag based on the target cascading style sheet corresponding to the target preview image.
[0012] Optionally, after calling the target plug-in to determine the type of the object to be uploaded, the method further includes: when the object to be uploaded is a local file, directly uploading the local file to the database in the backend server.
[0013] According to another aspect of an embodiment of the present application, a file uploading device is also provided, including: a judgment module, which is used to call a target plug-in to determine the type of the object to be uploaded when detecting that an object to be uploaded is input in a file upload tag; an acquisition module, which is used to call the target plug-in to acquire the network file stored in the network address when the object to be uploaded is a network address, wherein the target plug-in includes a preloaded first dynamic scripting language program, and the first dynamic scripting language program is used to acquire the network file stored in the network address; an upload module, which is used to upload the network file to a database in a back-end server.
[0014] According to another aspect of an embodiment of the present application, a non-volatile storage medium is further provided, the non-volatile storage medium including a stored program, wherein the device where the non-volatile storage medium is located executes the above-mentioned file uploading method by running the program.
[0015] According to another aspect of an embodiment of the present application, an electronic device is further provided, the electronic device comprising: a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to execute the above-mentioned file uploading method through the computer program.
[0016] In the embodiment of the present application, when the object to be uploaded is detected in the file upload tag, the target plug-in is called to determine the type of the object to be uploaded; when the object to be uploaded is a network address, the target plug-in is called to obtain the network file stored in the network address, wherein the target plug-in includes a preloaded first dynamic scripting language program, and the first dynamic scripting language program is used to obtain the network file stored in the network address; the network file is uploaded to the database in the back-end server. This avoids the situation where the front-end developer needs to modify the code repeatedly because the file provided by the web page cannot meet the functional requirements and aesthetic requirements, thereby solving the technical problem that the file upload function provided by the web page in the related technology is difficult to meet the user's needs. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0018] Figure 1 This is a hardware structure block diagram of an optional computer terminal for implementing file uploading according to an embodiment of the present application;
[0019] Figure 2 It is a flowchart of an optional method for implementing file uploading according to an embodiment of the present application;
[0020] Figure 3 It is a display style diagram of an optional file tag according to an embodiment of the present application;
[0021] Figure 4 is a structural schematic diagram of an optional file uploading device according to an embodiment of the present application; DETAILED DESCRIPTION
[0022] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present application.
[0023] It should be noted that the terms "first", "second", etc. in the specification, claims and drawings of the present application are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0024] In order to better understand the embodiments of the present application, some nouns or terms that appear in the description of the embodiments of the present application are first translated and explained as follows:
[0025] Cascading Style Sheets (Css) file: Cascading Style Sheets is a computer language used to express the style of files such as HTML (an application of Standard Generalized Markup Language) or XML (a subset of Standard Generalized Markup Language). Cascading Style Sheets can not only modify web pages statically, but also dynamically format the elements of web pages with various scripting languages. Cascading Style Sheets files can also be generally called CSS external style sheets, which are text files used to store CSS codes.
[0026] Dynamic scripting language (JavaScript, JS) file: refers to a text document containing JavaScript code lines. When users need to find JavaScript code from the js file in the web server to implement functions on the web page, the web page will reference these JavaScript codes.
[0027] Example 1
[0028] Since the file upload function provided by the current web page is difficult to meet user needs, in order to solve this problem, the embodiment of the present application provides an embodiment of a file upload method, which will be described in detail in the following embodiment.
[0029] It should be noted that the steps shown in the flowcharts of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and that, although a logical order is shown in the flowcharts, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0030] The method embodiments provided in the embodiments of the present application may be executed in a mobile terminal, a computer terminal or a similar computing device. Figure 1FIG. 1 shows a hardware structure block diagram of a computer terminal for realizing file uploading. Figure 1 As shown, the computer terminal 10 may include one or more (102a, 102b, ..., 102n are used to illustrate) processors 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA), a memory 104 for storing data, and a transmission module 106 for communication functions. In addition, it may also include: a display, an input / output interface (I / O interface), a universal serial bus (USB) port (which may be included as one of the ports of the BUS bus), a network interface, a power supply and / or a camera. It can be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the above electronic device. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations are shown.
[0031] It should be noted that the one or more processors 102 and / or other data processing circuits described above may generally be referred to herein as "data processing circuits". The data processing circuits may be embodied in whole or in part as software, hardware, firmware, or any other combination thereof. In addition, the data processing circuit may be a single independent processing module, or may be incorporated in whole or in part into any of the other components in the computer terminal 10 (or mobile device). As described in the embodiments of the present application, the data processing circuit acts as a processor control (e.g., selection of a variable resistor terminal path connected to an interface).
[0032] The memory 104 can be used to store software programs and modules of application software, such as the program instructions / data storage device corresponding to the file upload method in the embodiment of the present application. The processor 102 executes various functional applications and data processing by running the software programs and modules stored in the memory 104, that is, the file upload method of the above-mentioned application is realized. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the computer terminal 10 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0033] The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the computer terminal 10. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0034] The display may be, for example, a touch screen liquid crystal display (LCD) that enables a user to interact with a user interface of the computer terminal 10 .
[0035] In the above operating environment, the present application embodiment provides a method for uploading files, such as Figure 2 As shown, the method includes steps S202-S206, wherein:
[0036] Step S202: when it is detected that an object to be uploaded is input in the file upload tag, the target plug-in is called to determine the type of the object to be uploaded.
[0037] There are multiple methods for detecting the input of the object to be uploaded in the file upload tag.
[0038] Specifically, Figure 3 An optional file tag display style diagram is shown, consisting of Figure 3 It can be seen that the file tag consists of two parts. One is the "upload file box", which is a web page code with a storage address pointing to the object to be uploaded. When the object to be uploaded is detected in the file tag, the storage path and name of the object to be uploaded can be viewed through the "upload file box", where the storage address points to the server; the other is the "upload" button. When the object to be uploaded is detected in the file tag, different upload operations are performed on the uploaded file according to the type of the object to be uploaded, and finally the "upload" button is clicked to complete the file upload operation.
[0039] Among them, the saving path of the object to be uploaded can be, for example: E:\New Folder\Network File, which means that the object to be uploaded is a network address, and the file upload operation can be completed through steps S204-S206; when the saving path of the object to be uploaded can be, for example: D:\New Folder\Local File, which means that the object to be uploaded is a local file, then the local file can be directly uploaded to the database in the back-end server.
[0040] It should be noted that the above-mentioned saving path of the object to be uploaded is only for illustration and is not limited thereto.
[0041] As an optional implementation of the present application, before calling the target plug-in to determine the object type of the object to be uploaded, the first dynamic script language program can also be loaded into the target plug-in; the function of calling the target plug-in is bound to the attributes of the file upload tag, and the target plug-in is initialized to make the target plug-in effective.
[0042] In addition, when front-end developers write codes, there may be a situation where the file upload function cannot meet the actual application scenario. Therefore, in the embodiment of the present application, the required first dynamic scripting language program can be pre-loaded into the target plug-in, and the function of the target plug-in is called and bound to the attribute of the file tag.
[0043] Step S204, when the object to be uploaded is a network address, calling the target plug-in to obtain the network file stored in the network address, wherein the target plug-in includes a preloaded first dynamic scripting language program, and the first dynamic scripting language program is used to obtain the network file stored in the network address.
[0044] Specifically, when the object to be uploaded is a network address, the first dynamic scripting language program in the target plug-in is first executed, and the network file is obtained from the network address; then the network file is stored in the file upload tag, thereby avoiding the problem of front-end developers repeatedly modifying the development code due to the inability to meet the user's complex functional requirements for uploading files to the web page, and effectively reducing the working time spent by developers.
[0045] As an optional implementation of the present application, since the front end may have a requirement to limit the size of uploaded files, the target plug-in in the embodiment of the present application may also include: a preloaded second dynamic scripting language program for detecting the file size.
[0046] Specifically, firstly, a first dynamic scripting language program in the target plug-in is executed to accurately obtain a network file from a network address; then, a second dynamic scripting language program in the target plug-in is executed to detect the size of the network file; when the size of the network file is not greater than a preset threshold, it indicates that the file size of the network file to be uploaded meets the front-end development requirements, and the network file can be stored in a file upload tag; and when the size of the network file is greater than the preset threshold, it indicates that the file size of the network file to be uploaded does not meet the front-end development requirements, and at this time, the system generates a first alarm message to prompt that the network file is too large to be uploaded.
[0047] As another optional implementation of the present application, since the front end needs to ensure the security of uploaded files, the target plug-in in the embodiment of the present application may also include: a preloaded third dynamic scripting language program for detecting file security.
[0048] Specifically, firstly, the first dynamic scripting language program in the target plug-in is executed to accurately obtain the network file from the network address; then, the third dynamic scripting language program in the target plug-in is executed to detect the security of the network file; when the detection result is that the network file is safe, it means that the file security of the network file to be uploaded meets the front-end development requirements, and the network file is stored in the file upload tag; and when the detection result is that there is an abnormality in the network file, it means that the file security of the network file to be uploaded does not meet the front-end development requirements. At this time, the system generates a second alarm information to prompt that the network file is abnormal and cannot be uploaded.
[0049] As another optional implementation of the present application, since the front end may need to upload multiple network files at one time, the target plug-in in the embodiment of the present application may also include: multiple preloaded cascading style sheet files.
[0050] The above solutions are all for satisfying the functional requirements of users for uploading files provided by web pages. However, the file tags provided by HTML cannot meet the aesthetic requirements of users for the application scenarios of uploading files provided by web pages, and are difficult to modify through CSS development code.
[0051] Therefore, in the embodiment itself, it is also possible to generate preview images of multiple tag styles corresponding to multiple cascading style sheets in response to a switching instruction for switching the tag style of the file upload tag, and display the preview images of the multiple tag styles; in response to the selected target preview image, adjust the tag style of the file upload tag based on the target cascading style sheet corresponding to the target preview image.
[0052] Step S206, uploading the network file to the database in the back-end server.
[0053] Specifically, when a front-end developer initiates an upload request to upload a file, the corresponding network file can be uploaded to the database of the back-end server from the file tag and stored.
[0054] It should be noted that the file uploading method of the embodiment of the present application can be applied to network file uploading of websites, browsers and reference programs.
[0055] In the embodiment of the present application, when the object to be uploaded is detected in the file upload tag, the target plug-in is called to determine the type of the object to be uploaded; when the object to be uploaded is a network address, the target plug-in is called to obtain the network file stored in the network address, wherein the target plug-in includes a preloaded first dynamic scripting language program, and the first dynamic scripting language program is used to obtain the network file stored in the network address; the network file is uploaded to the database in the back-end server. This avoids the situation where the front-end developer needs to modify the code repeatedly because the file provided by the web page cannot meet the functional requirements and aesthetic requirements, thereby solving the technical problem that the file upload function provided by the web page in the related technology is difficult to meet the user's needs.
[0056] Example 2
[0057] According to an embodiment of the present application, a file uploading device for implementing the file uploading method in Embodiment 1 is also provided. Figure 4 As shown, the file uploading device at least includes a judgment module 41, an acquisition module 42 and an uploading module 43, wherein:
[0058] The determination module 41 is used to call the target plug-in to determine the type of the object to be uploaded when detecting that the object to be uploaded is input in the file upload tag.
[0059] As an optional implementation of the present application, before calling the target plug-in to determine the object type of the object to be uploaded, the judgment module 41 can also load the first dynamic scripting language program into the target plug-in; bind the function of calling the target plug-in to the attributes of the file upload tag, and initialize the target plug-in to make the target plug-in effective.
[0060] In addition, when front-end developers write codes, there may be a situation where the file upload function cannot meet the actual application scenario. Therefore, in the embodiment of the present application, the required first dynamic scripting language program can be pre-loaded into the target plug-in, and the function of calling the target plug-in is bound to the attribute of the file tag, which can be directly called the next time it is used.
[0061] The acquisition module 42 is used to call the target plug-in to acquire the network file stored in the network address when the object to be uploaded is a network address, wherein the target plug-in includes a preloaded first dynamic scripting language program, and the first dynamic scripting language program is used to acquire the network file stored in the network address.
[0062] Specifically, when the object to be uploaded is a network address, the acquisition module 42 first executes the first dynamic scripting language program in the target plug-in and obtains the network file from the network address; then the network file is stored in the file upload tag, thereby avoiding the problem of front-end developers repeatedly modifying the development code due to the inability to meet the user's complex functional requirements for uploading files to the web page, and effectively reducing the working time consumed by developers.
[0063] As an optional implementation of the present application, since the front end may have a requirement to limit the size of uploaded files, the target plug-in in the embodiment of the present application may also include: a preloaded second dynamic scripting language program for detecting the file size.
[0064] Specifically, firstly, a first dynamic scripting language program in the target plug-in is executed to accurately obtain a network file from a network address; then, a second dynamic scripting language program in the target plug-in is executed to detect the size of the network file; when the size of the network file is not greater than a preset threshold, it indicates that the file size of the network file to be uploaded meets the front-end development requirements, and the network file can be stored in a file upload tag; and when the size of the network file is greater than the preset threshold, it indicates that the file size of the network file to be uploaded does not meet the front-end development requirements, and at this time, the system generates a first alarm message to prompt that the network file is too large to be uploaded.
[0065] As another optional implementation of the present application, since the front end needs to ensure the security of uploaded files, the target plug-in in the embodiment of the present application may also include: a preloaded third dynamic scripting language program for detecting file security.
[0066] Specifically, firstly, the first dynamic scripting language program in the target plug-in is executed to accurately obtain the network file from the network address; then, the third dynamic scripting language program in the target plug-in is executed to detect the security of the network file; when the detection result is that the network file is safe, it means that the file security of the network file to be uploaded meets the front-end development requirements, and the network file is stored in the file upload tag; and when the detection result is that there is an abnormality in the network file, it means that the file security of the network file to be uploaded does not meet the front-end development requirements. At this time, the system generates a second alarm information to prompt that the network file is abnormal and cannot be uploaded.
[0067] As another optional implementation of the present application, since the front end may need to upload multiple network files at one time, the target plug-in in the embodiment of the present application may also include: multiple preloaded cascading style sheet files.
[0068] The above solutions are all for satisfying the functional requirements of users for uploading files provided by web pages. However, the file tags provided by HTML cannot meet the aesthetic requirements of users for the application scenarios of uploading files provided by web pages, and are difficult to modify through CSS development code.
[0069] Therefore, in the embodiment itself, it is also possible to generate preview images of multiple tag styles corresponding to multiple cascading style sheets in response to a switching instruction for switching the tag style of the file upload tag, and display the preview images of the multiple tag styles; in response to the selected target preview image, adjust the tag style of the file upload tag based on the target cascading style sheet corresponding to the target preview image.
[0070] The upload module 43 is used to upload the network file to the database in the back-end server.
[0071] Specifically, when the front-end developer initiates an upload request to upload a file, the upload module 43 can upload the corresponding network file from the file tag to the database of the back-end server and store it.
[0072] In actual application, the file uploading device of the embodiment of the present application can also be applied to websites, browsers and reference programs to realize the file uploading function.
[0073] It should be noted that each module in the file upload device in the embodiment of the present application corresponds one-to-one to each implementation step of the file upload method in Example 1. Since a detailed description has been given in Example 1, some details not reflected in this embodiment can be referred to Example 1 and will not be repeated here.
[0074] Example 3
[0075] According to an embodiment of the present application, a non-volatile storage medium is also provided, which includes a stored program, wherein the device where the non-volatile storage medium is located executes the file upload method in Example 1 by running the program.
[0076] Specifically, the device where the non-volatile storage medium is located implements the following steps by running the program: when detecting that an object to be uploaded is input in a file upload tag, calling a target plug-in to determine the type of the object to be uploaded; when the object to be uploaded is a network address, calling a target plug-in to obtain a network file stored in the network address, wherein the target plug-in includes a preloaded first dynamic scripting language program, and the first dynamic scripting language program is used to obtain a network file stored in the network address; uploading the network file to a database in a back-end server.
[0077] Optionally, calling the target plug-in to obtain the network file stored in the network address includes: executing a first dynamic scripting language program in the target plug-in to obtain the network file from the network address; and storing the network file in a file upload tag.
[0078] Optionally, the target plug-in also includes a preloaded second dynamic script language program for detecting the file size. After obtaining the network file from the network address, it also includes: executing the second dynamic script language program in the target plug-in to detect the size of the network file; when the size of the network file is not greater than a preset threshold, storing the network file in a file upload tag; when the size of the network file is greater than the preset threshold, generating a first alarm message, the first alarm message being used to prompt that the network file is too large to be uploaded.
[0079] Optionally, the target plug-in also includes a preloaded third dynamic scripting language program for detecting the security of files. After obtaining the network file from the network address, it also includes: executing the third dynamic scripting language program in the target plug-in, detecting the security of the network file, and obtaining a detection result; when the detection result is that the network file is safe, storing the network file in a file upload tag; when the detection result is that there is an abnormality in the network file, generating a second alarm information, and the second alarm information is used to prompt that the network file is abnormal and cannot be uploaded.
[0080] Optionally, the target plug-in also includes multiple preloaded cascading style sheet files, and also includes: in response to a switching instruction for switching the tag style of the file upload tag, generating preview images of multiple tag styles corresponding to multiple cascading style sheets, and displaying the preview images of multiple tag styles; in response to a selected target preview image, adjusting the tag style of the file upload tag based on the target cascading style sheet corresponding to the target preview image.
[0081] Example 4
[0082] According to an embodiment of the present application, a processor is also provided, which is used to run a program, wherein the file uploading method in Example 1 is executed when the program is running.
[0083] Specifically, the following steps are executed when the program is running: when it is detected that an object to be uploaded is input in a file upload tag, a target plug-in is called to determine the type of the object to be uploaded; when the object to be uploaded is a network address, the target plug-in is called to obtain a network file stored in the network address, wherein the target plug-in includes a preloaded first dynamic scripting language program, and the first dynamic scripting language program is used to obtain a network file stored in the network address; and the network file is uploaded to a database in a back-end server.
[0084] Optionally, calling the target plug-in to obtain the network file stored in the network address includes: executing a first dynamic scripting language program in the target plug-in to obtain the network file from the network address; and storing the network file in a file upload tag.
[0085] Optionally, the target plug-in also includes a preloaded second dynamic script language program for detecting the file size. After obtaining the network file from the network address, it also includes: executing the second dynamic script language program in the target plug-in to detect the size of the network file; when the size of the network file is not greater than a preset threshold, storing the network file in a file upload tag; when the size of the network file is greater than the preset threshold, generating a first alarm message, the first alarm message being used to prompt that the network file is too large to be uploaded.
[0086] Optionally, the target plug-in also includes a preloaded third dynamic scripting language program for detecting the security of files. After obtaining the network file from the network address, it also includes: executing the third dynamic scripting language program in the target plug-in, detecting the security of the network file, and obtaining a detection result; when the detection result is that the network file is safe, storing the network file in a file upload tag; when the detection result is that there is an abnormality in the network file, generating a second alarm information, and the second alarm information is used to prompt that the network file is abnormal and cannot be uploaded.
[0087] Optionally, the target plug-in also includes multiple preloaded cascading style sheet files, and also includes: in response to a switching instruction for switching the tag style of the file upload tag, generating preview images of multiple tag styles corresponding to multiple cascading style sheets, and displaying the preview images of multiple tag styles; in response to a selected target preview image, adjusting the tag style of the file upload tag based on the target cascading style sheet corresponding to the target preview image.
[0088] Example 5
[0089] According to an embodiment of the present application, an electronic device is also provided, which includes: a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to execute the file uploading method in Example 1 through the computer program.
[0090] Specifically, the processor is configured to execute the following steps through a computer program: when detecting that an object to be uploaded is input in a file upload tag, calling a target plug-in to determine the type of the object to be uploaded; when the object to be uploaded is a network address, calling a target plug-in to obtain a network file stored in the network address, wherein the target plug-in includes a preloaded first dynamic scripting language program, and the first dynamic scripting language program is used to obtain a network file stored in the network address; uploading the network file to a database in a back-end server.
[0091] Optionally, calling the target plug-in to obtain the network file stored in the network address includes: executing a first dynamic scripting language program in the target plug-in to obtain the network file from the network address; and storing the network file in a file upload tag.
[0092] Optionally, the target plug-in also includes a preloaded second dynamic script language program for detecting the file size. After obtaining the network file from the network address, it also includes: executing the second dynamic script language program in the target plug-in to detect the size of the network file; when the size of the network file is not greater than a preset threshold, storing the network file in a file upload tag; when the size of the network file is greater than the preset threshold, generating a first alarm message, the first alarm message being used to prompt that the network file is too large to be uploaded.
[0093] Optionally, the target plug-in also includes a preloaded third dynamic scripting language program for detecting the security of files. After obtaining the network file from the network address, it also includes: executing the third dynamic scripting language program in the target plug-in, detecting the security of the network file, and obtaining a detection result; when the detection result is that the network file is safe, storing the network file in a file upload tag; when the detection result is that there is an abnormality in the network file, generating a second alarm information, and the second alarm information is used to prompt that the network file is abnormal and cannot be uploaded.
[0094] Optionally, the target plug-in also includes multiple preloaded cascading style sheet files, and also includes: in response to a switching instruction for switching the tag style of the file upload tag, generating preview images of multiple tag styles corresponding to multiple cascading style sheets, and displaying the preview images of multiple tag styles; in response to a selected target preview image, adjusting the tag style of the file upload tag based on the target cascading style sheet corresponding to the target preview image.
[0095] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.
[0096] In the above embodiments of the present application, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.
[0097] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of units can be a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.
[0098] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed over multiple units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0099] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0100] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art or all or part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, server or network device, etc.) to perform all or part of the steps of each embodiment method of the present application. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, disk or optical disk, etc. Various media that can store program codes.
[0101] The above are only preferred implementations of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.
Claims
1. A file upload method, applied to a front-end web page, characterized in that: include: When detecting that an object to be uploaded is input in the file upload tag, calling the target plug-in to determine the type of the object to be uploaded; When the object to be uploaded is a network address, calling the target plug-in to obtain a network file stored in the network address, wherein the target plug-in includes a preloaded first dynamic scripting language program, and the first dynamic scripting language program is used to obtain the network file stored in the network address; The network file is uploaded to the database in the back-end server.
2. The method according to claim 1, characterized in that: Before calling the target plug-in to determine the object type of the object to be uploaded, the method further includes: Loading the first dynamic scripting language program into the target plug-in; The function of calling the target plug-in is bound to the attribute of the file upload tag, and the target plug-in is initialized.
3. The method according to claim 1, characterized in that Calling the target plug-in to obtain the network file stored in the network address includes: Executing the first dynamic scripting language program in the target plug-in to obtain the network file from the network address; The network file is stored in the file upload tag.
4. The method according to claim 3, characterized in that The target plug-in also includes a preloaded second dynamic scripting language program for detecting the file size. After obtaining the network file from the network address, the method further includes: Executing the second dynamic scripting language program in the target plug-in to detect the size of the network file; When the size of the network file is not greater than a preset threshold, storing the network file in the file upload tag; When the size of the network file is larger than the preset threshold, a first alarm message is generated, where the first alarm message is used to prompt that the network file is too large to be uploaded.
5. The method according to claim 3, characterized in that: The target plug-in also includes a preloaded third dynamic scripting language program for detecting file security. After obtaining the network file from the network address, the method further includes: Executing the third dynamic scripting language program in the target plug-in to detect the security of the network file and obtain a detection result; When the detection result shows that the network file is safe, storing the network file in the file upload tag; When the detection result indicates that the network file is abnormal, a second alarm message is generated, where the second alarm message is used to prompt that the network file is abnormal and cannot be uploaded.
6. The method according to claim 1, characterized in that The target plug-in also includes a plurality of preloaded cascading style sheet files, and the method further includes: In response to a switching instruction for switching the tag style of the file upload tag, generating preview images of multiple tag styles corresponding to the multiple cascading style sheets, and displaying the preview images of the multiple tag styles; In response to the selected target preview image, the tag style of the file upload tag is adjusted based on the target cascading style sheet corresponding to the target preview image.
7. The method according to claim 1, characterized in that After calling the target plug-in to determine the type of the object to be uploaded, the method further includes: When the object to be uploaded is a local file, the local file is directly uploaded to the database in the back-end server.
8. A file uploading device, characterized in that: include: A judgment module, configured to call a target plug-in to judge the type of the object to be uploaded when detecting that an object to be uploaded is input in a file upload tag; an acquisition module, configured to, when the object to be uploaded is a network address, call the target plug-in to acquire the network file stored in the network address, wherein the target plug-in includes a preloaded first dynamic scripting language program, and the first dynamic scripting language program is used to acquire the network file stored in the network address; The upload module is used to upload the network file to the database in the back-end server.
9. A non-volatile storage medium, characterized in that: The non-volatile storage medium includes a stored program, wherein the device where the non-volatile storage medium is located executes the file upload method described in any one of claims 1 to 7 by running the program.
10. An electronic device, characterized in that: include: A memory and a processor, wherein the memory stores a computer program, and the processor is configured to execute the file uploading method according to any one of claims 1 to 7 through the computer program.
Citation Information
Patent Citations
Network file storage method for thin client
CN102420870A
File upload method and device
CN106230919A
Cited By
Lightweight general file uploading system capable of realizing second transmission
CN121284025A
A lightweight universal file uploading system capable of achieving second transmission
CN121284025B