Multi
file Submissions

In a basic scenario, a submission contains a source code that is a single file. Multi-file mode allows for creating submissions consisting of multiple files.

Thanks to this, it is possible to:

  • launch complex projects consisting of multiple files,
  • use external libraries,
  • attach files that are not source code,
  • attach configuration files.

Sending all files as an archive (.tar.gz)

Use this method when you want to send a complex project containing a large number of files (e.g., when attaching an external library).

The archive is sent using the source parameter of the POST /submissions method. The following examples present how to send multi-file submission using either the curl command or PHP Client library. There are separate examples for the Compilers and the Problems modules of Sphere Engine:

Sending all files separately

Use this method for a small number of files.

Individual files are uploaded using the files parameter of the POST /submissions method (the source parameter is ignored in this case). Execute the files parameter multiple times, separately for each file.

An example of using the curl command on Linux:

Submission containing binary data

A submission can be sent in the form of binary data (e.g., when uploading an archive) or contain binary data (e.g., graphic files). Therefore, when using the multi-file mode you must create requests in the MULTIPART format (i.e. Content-Type: multipart/form-data)

It is impossible to use the JSON format and we advise against using the FORM format. In this case, the binary data is converted to a text format which can result in transferring big files and creating unnecessary overhead.

Note: The MULTIPART format allows you to transfer files in their explicit form, i.e., without converting them to a text format. The examples presented above (curl commands) use this approach.

The structure of a multi-file submission

The structure of files and directories of submissions sent in the multi-file mode is not limited in any way. However, some programming languages ​​require sending an entry file with the appropriate name and extension (depending on the programming language).

The entry file will be used to execute the submission. It must be located at the highest level of the submission's directory structure. For example, a submission in Python must contain a file named prog.pyand this file will be executed.

Supported programming languages

The following table shows a list of programming languages supported by the multi-file mode. In addition, we define the entry file, which should be located at the highest level of the submission's directory structure:

ID Name Entry file
1 C++ (gcc) a file with a "cpp" extension containing a function named "main"
2 Pascal (gpc) prog.pas
3 Perl prog.pl
4 Python 2 prog.py
10 Java a file with a "java" extension containing a class that has a method named "main"
11 C (gcc) a file with a "c" extension containing a function named "main"
15 Prolog prog
17 Ruby prog.rb
19 Pike prog
21 Haskell prog.hs
22 Pascal (fpc) prog.pas
26 Lua prog.lua
27 C# a file with a "cs" extension containing a class that has a method named "main"
28 Bash prog.sh
29 PHP prog.php
35 JavaScript (rhino) prog.js
39 Scala a file with a "scala" extension containing a global scope class named "Main"
43 Objective-C prog.m
48 Dart prog.dart
50 VB.net a file with a "vb" extension containing a module that has a function named "Main"
54 Perl 6 prog.pl
55 Java - legacy a file with a "java" extension containing a class that has a method named "main"
56 Node.js prog.js
99 Python (PyPy) prog.py
104 AWK (gawk) prog.awk
114 Go a file with a "go" extension containing the function named "main" in the main package
116 Python 3 prog.py
117 R prog.r
126 Python 3 nbc prog.py