--- title: "Upload code as a ZIP" description: "Create a function from a ZIP of code instead of the editor, with the ZIP rules, size limits, and forbidden files it must follow." content_type: "how-to" product: "functions" platform: "MyAccount" url: "/myaccount/functions/how-to/upload-code-as-a-zip/" topic: ["create"] relationships: {"requires":["/myaccount/functions/how-to/create-a-function/"]} --- # Upload code as a ZIP Instead of typing code in the editor, you can create a function from a ZIP of your code. Use a ZIP for a larger project, or for code you already have on your own machine. Every runtime takes a ZIP, **Custom Container Image** included. ## Before you begin Open **Create Function** and choose the hardware and runtime, as in [Create a function](/myaccount/functions/how-to/create-a-function/). To see the layout your runtime needs, download its sample from **ZIP File Guidelines & Template Download**. The sample is named after the runtime, such as `python-3.11-http.zip`. The section also lists the ZIP rules. ## Prepare the ZIP Put everything in one root directory inside the ZIP, and give the runtime's required files their exact names. The root directory can have any name, and it can hold other files too. For a Python HTTP runtime, the ZIP looks like this: ```text my-function/ func.py requirements.txt ``` For a Node.js HTTP runtime: ```text my-function/ index.mjs package.json ``` For the files each runtime needs, see [Runtimes and hardware](/myaccount/functions/concepts/runtimes-and-hardware/#language-runtimes). A ZIP can be up to 50 MB compressed and 200 MB extracted. Leave out executable and archive files: `.exe`, `.dll`, `.sh`, `.bat`, `.pyc`, `.class`, `.jar`, and `.zip`. A ZIP that contains any of them is refused. ## Upload the ZIP 1. Above the editor, find the upload area "Drag and drop your .zip file here (max 50MB), or click to upload". 2. Drop your ZIP on it, or click it and choose the file. MyAccount checks the ZIP. If it passes, its files open in the editor, one tab per file. If the check finds a problem, MyAccount shows one of these messages instead: - "The uploaded ZIP file is too large. Maximum allowed size is 50MB." See [The uploaded ZIP file is too large](/myaccount/functions/troubleshooting/functions/#the-uploaded-zip-file-is-too-large-maximum-allowed-size-is-50mb). - "File must be a ZIP archive" or "File is not a valid ZIP archive". See [File must be a ZIP archive](/myaccount/functions/troubleshooting/functions/#file-must-be-a-zip-archive). - "Invalid ZIP structure. Expected single root directory". See [Invalid ZIP structure](/myaccount/functions/troubleshooting/functions/#invalid-zip-structure-expected-single-root-directory). - "Missing required files in root: {files}", with the missing files in place of `{files}`. See [Missing required files in root](/myaccount/functions/troubleshooting/functions/#missing-required-files-in-root-files). ## Create the function Fill in the rest of the form as in [Create a function](/myaccount/functions/how-to/create-a-function/), and click **Create**. A ZIP whose files sit at the top, in no root directory, passes the upload check. It is refused when you click **Create**, with "Your function code does not adhere to the E2E Function format as suggested, please review your code." The rejected function still appears in the list as **Failed**. Put the files in one root directory, zip that directory, and create the function again. To reuse the name, delete the failed function first. See [Function with name {name} already exists](/myaccount/functions/troubleshooting/functions/#function-with-name-name-already-exists). ## Check that the function is running The function moves through **Creating** and **Deploying**, then reads **Running** once the ZIP has deployed. If the function reads **Failed** after a build, open its page and read the **Build Logs** tab. See [Troubleshooting Functions](/myaccount/functions/troubleshooting/functions/). You now have a function built from your ZIP. To change the code later, edit it in the editor or upload a fresh ZIP on the function's page. See [Edit a function](/myaccount/functions/how-to/edit-a-function/).