[go: up one dir, main page]

CN108551481B - File uploading method and device, server and storage medium - Google Patents

File uploading method and device, server and storage medium Download PDF

Info

Publication number
CN108551481B
CN108551481B CN201810338366.8A CN201810338366A CN108551481B CN 108551481 B CN108551481 B CN 108551481B CN 201810338366 A CN201810338366 A CN 201810338366A CN 108551481 B CN108551481 B CN 108551481B
Authority
CN
China
Prior art keywords
file
uploading
python
temporary folder
uploaded
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.)
Active
Application number
CN201810338366.8A
Other languages
Chinese (zh)
Other versions
CN108551481A (en
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.)
Shaanxi Heng Xinda Intellectual Property Services Co ltd
Original Assignee
Wuhan Douyu Network 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 Wuhan Douyu Network Technology Co Ltd filed Critical Wuhan Douyu Network Technology Co Ltd
Priority to CN201810338366.8A priority Critical patent/CN108551481B/en
Publication of CN108551481A publication Critical patent/CN108551481A/en
Application granted granted Critical
Publication of CN108551481B publication Critical patent/CN108551481B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/06Protocols specially adapted for file transfer, e.g. file transfer protocol [FTP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/26Special purpose or proprietary protocols or architectures

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computing Systems (AREA)
  • Computer Security & Cryptography (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The embodiment of the invention discloses a file uploading method, a file uploading device, a server and a storage medium, wherein the file uploading method comprises the following steps: and receiving at least one file to be uploaded, storing the at least one file to be uploaded in a temporary folder of the Node server, calling a Python uploading script module, and uploading the file in the temporary folder through an application programming interface following a simple storage service protocol. The embodiment of the invention overcomes the defect that the existing Node server can not directly upload the files stored in the Node server to the storage space following the simple storage service protocol, and achieves the effect of conveniently and quickly uploading the files in the Node server to the storage space following the simple storage service protocol.

Description

File uploading method and device, server and storage medium
Technical Field
The embodiment of the invention relates to the technical field of file resource uploading and storage, in particular to a file uploading method, a file uploading device, a server and a storage medium.
Background
The traditional resource uploading mode is to upload file resources to a traditional server, but with the development of the internet, internet software, especially enterprise-level application software, has a relatively large demand for uploading file resources, and especially when the scale of an enterprise or the scale of a user is increased sharply, if all file resources are continuously uploaded to the traditional server, the demand for uploading file resources is difficult to meet.
The Ceph cluster well solves the problems, and uploading the file resources to the Ceph cluster can well meet the requirement of enterprises on uploading the file resources. Js is generally written by a Node, and since a Ceph cluster follows amazon Simple Storage Service protocol (S3 protocol), and Node does not have native support for S3 protocol, uploading file resources in the Node server to the Ceph cluster has a problem that the two can not communicate. Thus, there is a need for a complete, universal solution for enabling node.
Disclosure of Invention
The embodiment of the invention provides a file uploading method, a file uploading device, a server and a storage medium, so that the effect of uploading files in a Node server to a storage space following an S3 protocol can be achieved.
In a first aspect, an embodiment of the present invention provides a file uploading method, where the method includes:
receiving at least one file to be uploaded, and storing the at least one file to be uploaded in a temporary folder of a Node server;
and calling a Python uploading script module, and uploading the files in the temporary folder through an application programming interface following a simple storage service protocol.
In a second aspect, an embodiment of the present invention further provides a file uploading apparatus, where the apparatus includes:
the Node server comprises a file storage module, a Node server and a Node server, wherein the file storage module is used for receiving at least one file to be uploaded and storing the at least one file to be uploaded into a temporary folder of the Node server;
and the file uploading module is used for calling the Python uploading script module and uploading the files in the temporary folder through an application programming interface following a simple storage service protocol.
In a third aspect, an embodiment of the present invention further provides a Node server, where the Node server includes:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the file upload method as described above.
In a fourth aspect, the embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the computer program implements the file uploading method as described above.
According to the file uploading method, the file uploading device, the server and the storage medium provided by the embodiment of the invention, at least one file to be uploaded is received, the at least one file to be uploaded is stored in a temporary folder of the Node server, then the Python uploading script module is called, and the file in the temporary folder is uploaded through an Application Programming Interface (API) following the S3 protocol, so that the defect that the existing Node server cannot directly upload the stored file to the storage space following the S3 protocol is overcome, and the effect of conveniently and quickly uploading the file in the Node server to the storage space following the S3 protocol is achieved.
Drawings
The above and other features and advantages of the present invention will become more apparent to those of ordinary skill in the art by describing in detail exemplary embodiments thereof with reference to the attached drawings, in which:
FIG. 1 is a flowchart of a file uploading method according to a first embodiment of the present invention;
FIG. 2 is a flowchart of a file uploading method in a second embodiment of the present invention;
fig. 3 is a flowchart of a file uploading method in the third embodiment of the present invention;
fig. 4 is a flowchart of a file uploading method in a fourth embodiment of the present invention;
fig. 5 is a schematic structural diagram of a file uploading apparatus in a fifth embodiment of the present invention;
fig. 6 is a schematic structural diagram of a server in a sixth embodiment of the present invention.
Detailed Description
The present invention will be described in further detail with reference to the accompanying drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting of the invention. It should be further noted that, for the convenience of description, only some of the structures related to the present invention are shown in the drawings, not all of the structures.
Example one
Fig. 1 is a flowchart of a file uploading method according to an embodiment of the present invention, where this embodiment is applicable to a situation where a file in a Node server needs to be uploaded to a storage space conforming to an S3 protocol, and the method may be executed by a file uploading apparatus, as shown in fig. 1, the method of this embodiment specifically includes:
s110, receiving at least one file to be uploaded, and saving the at least one file to be uploaded in a temporary folder of the Node server.
In this embodiment, the user may upload the file resource that is finally uploaded to the storage space following the S3 protocol through the client, and temporarily store the file resource in the Node server corresponding to the client. The Node server is a server written by Node. js, and the Node. js is a server development platform for operating Javascript, so that the Javascript can be developed on the server as PHP, Python and other languages.
Specifically, a user uploads at least one file to be uploaded to a storage space conforming to an S3 protocol at a client, a form of the client sends the at least one file to be uploaded to a Node server, and the Node server stores the received at least one file to be uploaded in a temporary folder for temporary storage after receiving the at least one file to be uploaded.
And S120, calling a Python uploading script module, and uploading the files in the temporary folder through an application programming interface following a simple storage service protocol.
Although the existing Node server cannot directly upload resources to the storage space following the S3 protocol, the Node server can conveniently and quickly call the Python scripting language, and the Python scripting language can also be perfectly adapted to the S3 protocol, so the Python scripting language can be used as an intermediate medium, and the Node server can conveniently and quickly upload the resources therein to the storage space following the S3 protocol, wherein the storage space following the S3 protocol may be a Ceph cluster.
In this embodiment, after saving at least one file to be uploaded in the temporary folder, the Node server may call a preset Python upload script module. The Python upload script module can establish a communication connection with the storage space following the S3 protocol, and can also upload files in the temporary folder to the storage space following the S3 protocol through the API following the S3 protocol.
In the file uploading method provided by this embodiment, at least one file to be uploaded is received, the at least one file to be uploaded is stored in the temporary folder, then the Python uploading script module is called, and the file in the temporary folder is uploaded through the API conforming to the S3 protocol, so that the defect that the existing Node server cannot directly upload the file stored in the Node server to the storage space conforming to the S3 protocol is overcome, and the effect of conveniently and quickly uploading the file in the Node server to the storage space conforming to the S3 protocol is achieved.
On the basis of the foregoing embodiments, further, after receiving at least one file to be uploaded, the method further includes:
and creating an empty temporary folder, wherein the temporary folder is used for storing at least one file to be uploaded.
After receiving at least one file to be uploaded, the Node server needs to store the file to be uploaded in a specific path, and at this time, an empty temporary folder may be preferably created for storing the received at least one file to be uploaded. It should be noted that the temporary folder may be created by the Node server in advance before receiving at least one file to be uploaded, and there is no special requirement for the temporary folder as long as it is empty when the Node server receives at least one file to be uploaded, so as to ensure that only the file that the user needs to upload at this time is stored in the temporary folder.
Example two
Fig. 2 is a flowchart of a file uploading method according to a second embodiment of the present invention. On the basis of the foregoing embodiments, this embodiment may select to receive at least one file to be uploaded, and store the at least one file to be uploaded in a temporary folder of a Node server, including: converting the received at least one file to be uploaded into a file stream; according to a preset rule and the content and format of each file in the file stream, checking the legality of each file in the file stream one by one; and if the file is legal, replacing the original file name of the file by using a random character string, and sequentially storing each file with the original file name replaced in the file stream into the temporary folder. As shown in fig. 2, the method of this embodiment specifically includes:
s210, receiving at least one file to be uploaded, and converting the received at least one file to be uploaded into a file stream.
The Node server converts at least one received file to be uploaded into a file stream so that the Node server can check the validity of each file according to preset rules. The file stream comprises at least one received file to be uploaded, and the file stream has directionality and continuity.
S220, according to the preset rules and the content and format of each file in the file stream, the legality of each file in the file stream is checked one by one.
In this embodiment, a Node server is preset with a file validity check module, which can check the validity of each file in a file stream one by one according to preset rules and the content and format of each file in the file stream. Specifically, the Node server may call the fs tool module to check whether the content of each file in the file stream is empty, and if the content of the file is not empty, determine that the file is a legal file; the Node server can also call a path tool module to check whether the format of each file in the file stream is normalized, and if the format of the file is checked to be normalized, the file is determined to be a legal file; the Node server may further set other preset rules to check the validity of each file in the file stream, where the preset rules may check whether the file in the file stream contains unhealthy content, and if it is checked that the file does not contain unhealthy content, determine that the corresponding file is a legal file.
And S230, if the file is legal, replacing the original file name of the file by using the random character string, and sequentially storing each file with the original file name replaced in the file flow into a temporary folder.
If the files in the file stream are verified to be legal, the original file names of the legal files in the file stream can be replaced by random character strings one by one aiming at the legal files. The original file names of legal files in the file stream are replaced one by using the random character strings, so that the problem of uploading coverage of files with the same name can be effectively prevented, and the problem of messy codes during subsequent Chinese coding can be avoided. The original file names of the legal files in the file stream are replaced by the random character strings one by one, and meanwhile, the legal files with the original file names replaced in the file stream can be sequentially stored in the temporary folder.
If the file in the file stream is checked to be illegal, the illegal file is discarded and is not saved in the temporary folder. Further, regarding the naming of the temporary folder, it is preferable to use the time point when the first legal file is stored. If the temporary folder is created after receiving at least one file to be uploaded, it can also be named by the time point when the temporary folder is created, and if the temporary folder is created in advance, it can also be named by the time point when it is detected that there is a file to be uploaded.
And S240, calling a Python uploading script module, and uploading the files in the temporary folder through an application programming interface following a simple storage service protocol.
The file uploading method provided by this embodiment converts at least one received file to be uploaded into a file stream, checks the legitimacy of each file in the file stream one by one according to the preset rules and the content and format of each file in the file stream, if the file is legal, replaces the original file name of the file with a random character string, sequentially stores each file with the original file name replaced in the file stream into a temporary folder, then calls a Python uploading script module, uploads the files in the temporary folder through an API following the S3 protocol, overcomes the defect that the existing Node server cannot directly upload the files stored therein to a storage space following the S3 protocol, achieves the effect of uploading the files in the Node server to the storage space following the S3 protocol conveniently and quickly, and also effectively prevents the problems of uploading coverage of the files with the same name and code disorder during Chinese coding, in addition, uploading of illegal files is avoided.
On the basis of the foregoing embodiments, after calling a Python upload script module and uploading a file in the temporary folder through an application programming interface conforming to a simple storage service protocol, the method further includes:
and deleting the temporary folder when the uploading of all the files in the temporary folder is detected to be finished.
In this embodiment, when it is detected that all files in the temporary folder are uploaded, it is preferable that the temporary folder be deleted in order to avoid a problem that the Node server is paralyzed due to more and more files in the Node server with the lapse of time. In addition, all files in the temporary folder can be deleted, and only the empty temporary folder is reserved. When the user uploads the file next time, the legal file in the file stream can be directly saved in the temporary folder. At this time, a new temporary folder does not need to be created, and only the name of the existing temporary folder needs to be modified.
EXAMPLE III
Fig. 3 is a flowchart of a file uploading method according to a third embodiment of the present invention. On the basis of the foregoing embodiments, this embodiment may select the Python upload script module to upload the file in the temporary folder through an application programming interface conforming to a simple storage service protocol, where the method includes: calling a first Python script file contained in the Python uploading script module by utilizing the Node file contained in the Python uploading script module; when the first Python script file is connected with a storage space following a simple storage service protocol, reading the file in the temporary folder by using a second Python script file contained in a Python uploading script module, and uploading the file in the temporary folder through an application programming interface following the simple storage service protocol. As shown in fig. 3, the method of this embodiment specifically includes:
s310, receiving at least one file to be uploaded, and saving the at least one file to be uploaded in a temporary folder of the Node server.
S320, calling a first Python script file contained in the Python uploading script module by utilizing the Node file contained in the Python uploading script module.
Preferably, the Python upload script module called by the Node server comprises a Node file and a first Python script file, wherein the Node file can call the first Python script file, and the first Python script file can establish a connection with a storage space following the S3 protocol. That is, the Node file calls the first Python script file to make the Node server establish indirect connection with the storage space following the S3 protocol.
S330, when the first Python script file is connected with a storage space following a simple storage service protocol, reading the file in the temporary folder by using a second Python script file contained in the Python uploading script module, and uploading the file in the temporary folder through an application programming interface following the simple storage service protocol.
Preferably, the Python upload script module further includes a second Python script file, and the script file can read a file in the temporary folder. When the first Python script file is successfully connected with the storage space following the S3 protocol, the second Python script file reads each file in the temporary folder of the Node server to prepare for uploading. After each file in the temporary folder is acquired, the second Python script file establishes connection with an API following the S3 protocol through the interface address parameter in the second Python script file, and uploads the files in the temporary folder through the API. It should be noted here that the interface address parameters in the second Python script file are different for different storage spaces conforming to the S3 protocol.
In addition, as the Python language belongs to the scripting language, the uploaded second Python script file can be directly embedded into the code of the Node server, so that the second Python script file can be conveniently and efficiently called and modified, and the problems of version and compatibility caused by introducing a third-party library do not exist.
In the file uploading method provided by this embodiment, at least one file to be uploaded is received, and the at least one file to be uploaded is stored in a temporary folder of the Node server, then the Node file included in the Python uploading script module is used to call the first Python script file included in the Python uploading script module, the first Python script file included in the Python uploading script module is used to read the file in the temporary folder, and the file in the temporary folder is uploaded through an application programming interface following a simple storage service protocol, so that a defect that the existing Node server cannot directly upload the file stored in the Node server to a storage space following an S3 protocol is overcome, and an effect of conveniently and quickly uploading the file in the Node server to the storage space following the S3 protocol is achieved.
On the basis of the foregoing embodiments, further, after reading the file in the temporary folder by using the second Python script file included in the Python upload script module and uploading the file in the temporary folder through an application programming interface conforming to a simple storage service protocol, the method further includes:
and receiving feedback information returned by the second Python script file, wherein the feedback information is used for determining whether the file in the temporary folder is successfully uploaded.
In this embodiment, when the second Python script file uploads the files in the obtained temporary folder one by one through the API conforming to the S3 protocol, the storage space conforming to the S3 protocol sends feedback information to the second Python script file regardless of whether the file is successfully uploaded. The feedback information is used for determining whether the files in the temporary folder are successfully uploaded. After receiving the feedback information, the second Python script file feeds the feedback information back to the Node server to inform the Node server whether the file is uploaded successfully. And after the Node server obtains the feedback information, the Node server also sends the feedback information to the client so as to inform the user whether the file is uploaded successfully.
If the file uploading fails, the file uploading method in the above embodiments may be used to re-upload the file.
Example four
The embodiment of the invention provides a preferable example of a file uploading method. Wherein, the storage space following the S3 protocol is a Ceph cluster.
S410, receiving at least one file to be uploaded.
S420, creating an empty temporary folder, wherein the temporary folder is used for storing at least one file to be uploaded.
S430, converting the received at least one file to be uploaded into a file stream.
S440, according to the content and the format of each file in the file stream, the legality of each file in the file stream is checked one by one.
S450, if the file is legal, replacing the original file name of the file by using the random character string, and sequentially storing each file with the original file name replaced in the file flow into a temporary folder.
And S460, calling a first Python script file contained in the Python uploading script module by utilizing the Node file contained in the Python uploading script module.
S470, when the first Python script file is connected with the storage space following the simple storage service protocol, reading the file in the temporary folder by using the second Python script file contained in the Python uploading script module, and uploading the file in the temporary folder to the Ceph cluster through the application programming interface following the simple storage service protocol.
And S480, receiving feedback information returned by the second Python script file, wherein the feedback information is used for determining whether the file in the temporary folder is successfully uploaded to the Ceph cluster.
And S490, deleting the temporary folder when the uploading of all the files in the temporary folder is detected to be finished.
In this embodiment, the user uploads at least one file to be uploaded into the storage space conforming to the S3 protocol through the client, and the Node server receives the at least one file to be uploaded. After receiving at least one file to be uploaded, the Node server creates an empty temporary folder for storing the at least one file to be uploaded. Before saving at least one file to be uploaded to the temporary folder, the validity of each file needs to be checked.
Specifically, the Node server converts at least one received file to be uploaded into a file stream, calls a preset file validity checking module to call an fs tool module and a path tool module, and determines whether each file in the file stream is valid or not by respectively checking whether the content of each file in the file stream is empty and whether the format of each file is standardized or not. And if the file in the file stream is verified to be legal, replacing the original file name of each legal file in the file stream by utilizing the random character string one by one aiming at each legal file, and sequentially storing each legal file with the original file name replaced in the file stream into the temporary folder.
After storing each legal file in the file stream into the temporary folder, the Node server calls a preset Python uploading script module, wherein the Python uploading script module comprises a Node file, a first Python script file and a second Python script file. The Node file calls the first Python script file to make the Node server establish indirect connection with the Ceph cluster following the S3 protocol. Thereafter, the second Python script file reads the files in the temporary folder and uploads the files in the temporary folder to the Ceph cluster through the API following the S3 protocol.
When the second Python script file uploads the read files to the Ceph cluster one by one, the Ceph cluster sends feedback information for determining whether the files in the temporary folder are uploaded successfully to the second Python script file, and after the feedback information is received, the second Python script file feeds the feedback information back to the Node server to inform the Node server whether the files are uploaded successfully. And after the Node server obtains the feedback information, the Node server also sends the feedback information to the client so as to inform the user whether the file is uploaded successfully. And deleting the temporary folder when the uploading of all the files in the temporary folder is detected to be finished.
EXAMPLE five
Fig. 5 is a schematic structural diagram of a file uploading apparatus in the fifth embodiment of the present invention. As shown in fig. 5, the file uploading apparatus includes:
a file saving module 510, configured to receive at least one file to be uploaded, and save the at least one file to be uploaded in a temporary folder of the Node server;
and the file uploading module 520 is used for calling the Python uploading script module and uploading the files in the temporary folder through an application programming interface following the simple storage service protocol.
The file uploading device provided by this embodiment receives at least one file to be uploaded by using the file saving module, saves the at least one file to be uploaded in the temporary folder, calls the Python uploading script module by using the file uploading module, and uploads the file in the temporary folder through the API conforming to the S3 protocol, thereby overcoming the defect that the existing Node server cannot directly upload the file stored therein to the storage space conforming to the S3 protocol, and achieving the effect of conveniently and quickly uploading the file in the Node server to the storage space conforming to the S3 protocol.
Further, the apparatus may further include: the temporary folder creating module is used for creating an empty temporary folder after receiving at least one file to be uploaded, and the temporary folder is used for storing the at least one file to be uploaded.
Further, the file saving module 510 may specifically include:
the file stream conversion submodule is used for converting the received at least one file to be uploaded into a file stream;
the file legality checking submodule is used for checking the legality of each file in the file stream one by one according to a preset rule and the content and format of each file in the file stream;
and the file saving submodule is used for replacing the original file name of the file by using the random character string if the file is legal, and sequentially saving each file with the original file name replaced in the file stream into the temporary folder.
Further, the file uploading module 520 may specifically include:
the first Python script file calling submodule is used for calling a first Python script file contained in a Python uploading script module by utilizing a Node file contained in the Python uploading script module;
and the file reading and uploading sub-module is used for reading the files in the temporary folder by using a second Python script file contained in the Python uploading script module when the first Python script file is connected with the storage space following the simple storage service protocol, and uploading the files in the temporary folder through an application programming interface following the simple storage service protocol.
Further, the apparatus may further include:
and the temporary folder deleting module is used for deleting the temporary folder when detecting that all files in the temporary folder are completely uploaded after calling the Python uploading script module and uploading the files in the temporary folder through an application programming interface following a simple storage service protocol.
Further, the apparatus may further include:
and the feedback information receiving module is used for reading the file in the temporary folder by using the second Python script file contained in the Python uploading script module, and receiving feedback information returned by the second Python script file after uploading the file in the temporary folder through an application programming interface following a simple storage service protocol, wherein the feedback information is used for determining whether the file in the temporary folder is successfully uploaded.
The file uploading device provided by the embodiment of the invention can execute the file uploading method provided by any embodiment of the invention, and has the corresponding functional modules and beneficial effects of the execution method.
EXAMPLE six
Fig. 6 is a schematic structural diagram of a Node server according to a sixth embodiment of the present invention. FIG. 6 illustrates a block diagram of an exemplary Node server 612 suitable for use in implementing embodiments of the present invention. The Node server 612 shown in fig. 6 is only an example, and should not bring any limitation to the function and the scope of the application of the embodiments of the present invention.
As shown in FIG. 6, Node server 612 is in the form of a general purpose computing device. The components of Node server 612 may include, but are not limited to: one or more processors 616, a memory 628, and a bus 618 that connects the various system components (including the memory 628 and the processors 616).
Bus 618 represents one or more of any of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, and a processor or local bus using any of a variety of bus architectures. By way of example, such architectures include, but are not limited to, Industry Standard Architecture (ISA) bus, micro-channel architecture (MAC) bus, enhanced ISA bus, Video Electronics Standards Association (VESA) local bus, and Peripheral Component Interconnect (PCI) bus.
The Node server 612 typically includes a variety of computer system readable media. These media may be any available media that can be accessed by the Node server 612 and includes both volatile and nonvolatile media, removable and non-removable media.
The memory 628 may include computer system readable media in the form of volatile memory, such as Random Access Memory (RAM)630 and/or cache memory 632. The Node server 612 may further include other removable/non-removable, volatile/nonvolatile computer system storage media. By way of example only, storage 634 may be used to read from and write to non-removable, nonvolatile magnetic media (not shown in FIG. 6, and commonly referred to as a "hard drive"). Although not shown in FIG. 6, a magnetic disk drive for reading from and writing to a removable, nonvolatile magnetic disk (e.g., a "floppy disk") and an optical disk drive for reading from or writing to a removable, nonvolatile optical disk (e.g., a CD-ROM, DVD-ROM, or other optical media) may be provided. In such cases, each drive may be connected to bus 618 by one or more data media interfaces. Memory 628 may include at least one program product having a set (e.g., at least one) of program modules that are configured to carry out the functions of embodiments of the invention.
A program/utility 640 having a set (at least one) of program modules 642 may be stored, for example, in memory 628, such program modules 642 including, but not limited to, an operating system, one or more application programs, other program modules, and program data, each of which examples or some combination thereof may comprise an implementation of a network environment. The program modules 642 generally perform the functions and/or methods of the described embodiments of the present invention.
The Node server 612 may also communicate with one or more external devices 614 (e.g., keyboard, pointing device, display 624, etc., where the display 624 may or may not be configured as desired), one or more devices that enable a user to interact with the Node server 612, and/or any device (e.g., network card, modem, etc.) that enables the Node server 612 to communicate with one or more other computing devices. Such communication may occur via input/output (I/O) interfaces 622. Also, the Node server 612 may communicate with one or more networks (e.g., a Local Area Network (LAN), a Wide Area Network (WAN) and/or a public network, such as the Internet) via the network adapter 620. As shown, the network adapter 620 communicates with the other modules of the Node server 612 via bus 618. It should be appreciated that although not shown in FIG. 6, other hardware and/or software modules may be used in conjunction with the Node server 612, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage, among others.
The processor 616 executes various functional applications and data processing, such as implementing a file upload method provided by an embodiment of the present invention, by executing programs stored in the memory 628.
EXAMPLE seven
The seventh embodiment of the present invention provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements a file uploading method provided in the embodiments of the present invention, and the method includes:
receiving at least one file to be uploaded, and storing the at least one file to be uploaded in a temporary folder of the Node server;
and calling a Python uploading script module, and uploading the files in the temporary folder through an application programming interface following a simple storage service protocol.
Of course, the computer program stored on the computer-readable storage medium provided in the embodiments of the present invention is not limited to execute the method operations described above, and may also execute related operations in the Node server-based file uploading method provided in any embodiment of the present invention.
Computer storage media for embodiments of the invention may employ any combination of one or more computer-readable media. The computer readable medium may be a computer readable signal medium or a computer readable storage medium. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples (a non-exhaustive list) of the computer readable storage medium would include the following: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
A computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Computer program code for carrying out operations for aspects of the present invention may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
It is to be noted that the foregoing is only illustrative of the preferred embodiments of the present invention and the technical principles employed. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, although the present invention has been described in greater detail by the above embodiments, the present invention is not limited to the above embodiments, and may include other equivalent embodiments without departing from the spirit of the present invention, and the scope of the present invention is determined by the scope of the appended claims.

Claims (8)

1. A file uploading method is characterized by comprising the following steps:
receiving at least one file to be uploaded, and storing the at least one file to be uploaded in a temporary folder of a Node server;
calling a Python uploading script module, and uploading the files in the temporary folder through an application programming interface following a simple storage service protocol;
the calling Python uploading script module uploads the files in the temporary folder through an application programming interface following a simple storage service protocol, and the calling Python uploading script module comprises the following steps:
calling a first Python script file contained in the Python uploading script module by utilizing the Node file contained in the Python uploading script module;
when the first Python script file is connected with a storage space following a simple storage service protocol, reading the file in the temporary folder by using a second Python script file contained in a Python uploading script module, and uploading the file in the temporary folder through an application programming interface following the simple storage service protocol.
2. The method according to claim 1, further comprising, after said receiving at least one file to be uploaded:
and creating an empty temporary folder, wherein the temporary folder is used for storing the at least one file to be uploaded.
3. The method according to claim 1, wherein the receiving at least one file to be uploaded and saving the at least one file to be uploaded in a temporary folder comprises:
converting the received at least one file to be uploaded into a file stream;
according to a preset rule and the content and format of each file in the file stream, checking the legality of each file in the file stream one by one;
and if the file is legal, replacing the original file name of the file by using a random character string, and sequentially storing each file with the original file name replaced in the file stream into the temporary folder.
4. The method of claim 1, after calling a Python upload script module to upload a file in the temporary folder through an application programming interface compliant with the simple storage service protocol, further comprising:
and deleting the temporary folder when all files in the temporary folder are detected to be uploaded completely.
5. The method according to claim 1, wherein after the reading the file in the temporary folder by using the second Python script file contained in the Python upload script module and uploading the file in the temporary folder through the application programming interface conforming to the simple storage service protocol, the method further comprises:
and receiving feedback information returned by the second Python script file, wherein the feedback information is used for determining whether the file in the temporary folder is successfully uploaded.
6. A file uploading apparatus, comprising:
the Node server comprises a file storage module, a Node server and a Node server, wherein the file storage module is used for receiving at least one file to be uploaded and storing the at least one file to be uploaded into a temporary folder of the Node server;
the file uploading module is used for calling a Python uploading script module and uploading the files in the temporary folder through an application programming interface following a simple storage service protocol;
the file uploading module specifically comprises:
the first Python script file calling submodule is used for calling a first Python script file contained in the Python uploading script module by utilizing the Node file contained in the Python uploading script module;
and the file reading and uploading sub-module is used for reading the files in the temporary folder by using a second Python script file contained in the Python uploading script module when the first Python script file is connected with a storage space following a simple storage service protocol, and uploading the files in the temporary folder through an application programming interface following the simple storage service protocol.
7. A Node server, comprising:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the file upload method of any of claims 1-5.
8. A computer-readable storage medium on which a computer program is stored, the program, when executed by a processor, implementing a file upload method according to any one of claims 1 to 5.
CN201810338366.8A 2018-04-16 2018-04-16 File uploading method and device, server and storage medium Active CN108551481B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810338366.8A CN108551481B (en) 2018-04-16 2018-04-16 File uploading method and device, server and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810338366.8A CN108551481B (en) 2018-04-16 2018-04-16 File uploading method and device, server and storage medium

Publications (2)

Publication Number Publication Date
CN108551481A CN108551481A (en) 2018-09-18
CN108551481B true CN108551481B (en) 2021-02-02

Family

ID=63515023

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810338366.8A Active CN108551481B (en) 2018-04-16 2018-04-16 File uploading method and device, server and storage medium

Country Status (1)

Country Link
CN (1) CN108551481B (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109981729B (en) * 2019-02-14 2022-04-05 视联动力信息技术股份有限公司 File processing method and device, electronic equipment and computer readable storage medium
CN109743405B (en) * 2019-02-20 2022-01-25 高新兴科技集团股份有限公司 Load balancing file uploading method and system, computer storage medium and equipment
CN112448965B (en) * 2019-08-27 2022-12-13 深圳Tcl数字技术有限公司 Data updating method, device, storage medium and intelligent terminal
CN111782730B (en) * 2020-07-09 2021-07-06 腾讯科技(深圳)有限公司 File uploading method and device and storage medium
CN112099863A (en) * 2020-09-21 2020-12-18 南京芯驰半导体科技有限公司 A method, device and computer-readable storage medium for updating startup screen

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105119737A (en) * 2015-07-16 2015-12-02 浪潮软件股份有限公司 Method for monitoring Ceph cluster through Zabbix
US9325791B1 (en) * 2013-03-12 2016-04-26 Western Digital Technologies, Inc. Cloud storage brokering service
CN106055388A (en) * 2016-06-25 2016-10-26 国云科技股份有限公司 A cloud platform application automatic deployment framework
CN106095527A (en) * 2016-06-07 2016-11-09 国云科技股份有限公司 A storage pool implementation method suitable for cloud platform virtual machines

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9325791B1 (en) * 2013-03-12 2016-04-26 Western Digital Technologies, Inc. Cloud storage brokering service
CN105119737A (en) * 2015-07-16 2015-12-02 浪潮软件股份有限公司 Method for monitoring Ceph cluster through Zabbix
CN106095527A (en) * 2016-06-07 2016-11-09 国云科技股份有限公司 A storage pool implementation method suitable for cloud platform virtual machines
CN106055388A (en) * 2016-06-25 2016-10-26 国云科技股份有限公司 A cloud platform application automatic deployment framework

Also Published As

Publication number Publication date
CN108551481A (en) 2018-09-18

Similar Documents

Publication Publication Date Title
CN108551481B (en) File uploading method and device, server and storage medium
CN109213611B (en) Cross-process communication method, device, terminal and storage medium
US9614931B2 (en) Identifying a resource set require for a requested application and launching the resource set in a container for execution in a host operating system
CN110580244A (en) A file processing method, device, server and storage medium
CN110825456A (en) Loading time calculation method and device, computer equipment and storage medium
CN112433920B (en) A method, device, equipment and medium for reporting buried data
CN107172070B (en) Resource access processing method and device
CN107404418B (en) Internet product testing method, device, equipment and storage medium
CN111290806A (en) Calling method and device of application program interface, computer equipment and storage medium
CN107451062B (en) User interface traversal test method, device, server and storage medium
US10461772B1 (en) Code conversion
CN109151033B (en) Communication method and device based on distributed system, electronic equipment and storage medium
CN104461698A (en) Dynamic virtual disk mounting method, virtual disk management device and distributed storage system
CN113794909A (en) Video streaming system, method, server, device, and storage medium
CN111324441A (en) Operating environment switching method and device, computer equipment and storage medium
CN112769802A (en) Access verification method and device based on server, electronic equipment and storage medium
CN110287146A (en) Application downloading method, device and computer storage medium
CN113384896A (en) Unity-based resource packaging method, device, equipment and medium
CN113191889A (en) Wind control configuration method, configuration system, electronic device and readable storage medium
CN113806035B (en) Distributed scheduling method and service server
CN108055594B (en) Implementation method, device, computer equipment and storage medium for edge slicing
US10659321B2 (en) Electronic apparatus for recording debugging information and control method thereof
CN111711713B (en) Data access method, computer device and storage medium
CN111176718B (en) Script online method and device, storage medium and electronic equipment
CN107862035A (en) Network reading method and device for conference record, intelligent tablet and storage medium

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
GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20240429

Address after: 712000, Building 201-2, West Life Science Park, Keyuan Fourth Road, Fengdong New City, Xixian New District, Xi'an City, Shaanxi Province, China

Patentee after: Shaanxi Heng XinDa intellectual property services Co.,Ltd.

Country or region after: China

Address before: 11 / F, building B1, phase 4.1, software industry, No.1, Software Park East Road, Wuhan East Lake Development Zone, Wuhan City, Hubei Province, 430070

Patentee before: WUHAN DOUYU NETWORK TECHNOLOGY Co.,Ltd.

Country or region before: China