# Using Front-End File Uploads in CoPilots

FormWise **CoPilots** allow **end users** to upload files (PDFs, CSVs, TXT files) during a chat conversation to **enhance AI responses with context-specific data.** This works similarly to **SmartForm file uploads**, but with CoPilots, the AI can dynamically request files during a chat or process uploaded documents in real-time.

This guide covers:\
✅ How **end users** can upload files in a CoPilot chat.\
✅ How **CoPilot owners** can structure prompt instructions to guide AI on file usage.\
✅ **Best practices** to avoid timeouts and optimize retrieval.

***

### **1️⃣ How Front-End File Uploads Work in CoPilots**

🔹 When chatting with a CoPilot, **end users** can upload **PDFs, CSVs, or TXT files** to provide the AI with reference material.\
🔹 The CoPilot will **process the uploaded file** and **incorporate relevant data** into its response.\
🔹 Unlike SmartForms, CoPilots allow the AI to **request a file upload dynamically** during a conversation.

<figure><img src="https://728196400-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0Lugni2T5TewiPeYs1ka%2Fuploads%2Fpy4wQQDEWLMArndrNL2t%2Fimage.png?alt=media&#x26;token=b7ef6f20-b49d-4948-808f-f797969b1edb" alt=""><figcaption></figcaption></figure>

💡 **Example Use Cases:**\
✅ **A legal CoPilot:** A user uploads a contract PDF, and the AI highlights key clauses.\
✅ **A financial CoPilot:** A user uploads a CSV with expenses, and the AI provides a budget breakdown.\
✅ **A customer service CoPilot:** A user uploads a TXT file with issue details, and the AI generates a support response.

🚨 **Avoid Combining Web Browsing & Web Scraping in a Single CoPilot Request**

While CoPilots can **analyze URLs** through **web scraping (extracting full webpage content)** and **web browsing (searching the web for real-time metadata),** combining both methods in a single request can **cause timeouts or incomplete responses.**

**📌 Best Practice:** If your CoPilot is set up to process URLs, decide whether you need **detailed webpage extraction (web scraping)** or **high-level search results (web browsing)**—but avoid using both simultaneously unless necessary. If needed, split these functions across different interactions in the conversation. 🚀

***

### **2️⃣ How CoPilot Owners Can Customize File Upload Behavior**

CoPilot owners can **guide AI behavior when processing uploaded files** using **prompt instructions.**

#### **🔹 Adding File Upload Instructions in the CoPilot Prompt**

When setting up a CoPilot, owners can:\
✅ **Tell the AI to request file uploads during the conversation.**\
✅ **Add instructions on how to use an uploaded file.**

📌 **Example CoPilot Prompt Instructions:**\
💬 **AI Requests a File:**\
\&#xNAN;*"If the user asks about a document or contract, ask them to upload a PDF for review."*

📌 **Example File Processing Instruction:**\
💡 **For a financial CoPilot:**\
\&#xNAN;*"If the user uploads a CSV, analyze the expenses and provide a summary of spending patterns."*

💡 **For a resume review CoPilot:**\
\&#xNAN;*"If the user uploads a resume, scan the document and provide feedback on structure, clarity, and ATS optimization."*

📌 \*\*These prompt instructions ensure AI **knows how to handle user-uploaded files**, making interactions **more dynamic and relevant.**

***

### **3️⃣ File Size Limits & Storage Behavior**

#### **🔹 File Size Limits (Per Upload)**

📌 **Pro Plan:** **2MB max per file** (multiple files allowed).\
📌 **Agency Plan:** **20MB max per file** (multiple files allowed).

🚀 **You can attach multiple files, but larger files can cause token issues and slow processing.**

#### **🔹 How Files Are Stored for End Users**

✅ Files are **temporarily stored in browser cookies** so users **don’t have to re-upload** if they refresh the chat.\
✅ Files **aren’t permanently stored**—when the session ends, uploaded files are no longer accessible.

***

### **4️⃣ How AI Retrieves & Processes Uploaded Files (RAG in Simple Terms)**

Just like in SmartForms, **Retrieval-Augmented Generation (RAG)** is used in CoPilots:\
1️⃣ The AI **reads the uploaded file’s text** and extracts **key insights.**\
2️⃣ The AI **retrieves relevant information** when responding.\
3️⃣ AI does **not** "train" on the file—it **only references** the content **for that conversation.**

🚨 **If a file is too large or contains too much text, AI may struggle to extract the right information, leading to slow or incomplete responses.**

***

### **5️⃣ Avoiding Timeouts & Optimizing Performance**

🔹 **If a CoPilot chat times out:**\
✅ **Reduce file sizes** (split large PDFs into sections).\
✅ **Limit the number of files uploaded in a single chat session.**\
✅ **Avoid combining uploads with web browsing or web scraping** in the same request.\
✅ **Use precise prompt instructions** to make AI focus on the right data.

📌 **Example Fix:**\
❌ **Bad:** "Analyze the entire 100-page PDF and summarize it."\
✅ **Better:** "Extract and summarize the top 3 key insights from this document."

***

#### **🚀 Conclusion**

CoPilots with **file uploads** allow end users to **chat dynamically with AI while providing real-time documents for reference.**

✅ **End users can upload PDFs, CSVs, and TXT files for AI to process in the conversation.**\
✅ **CoPilot owners can guide AI to request and handle file uploads** with customized prompt instructions.\
✅ **Follow best practices** to optimize performance and avoid timeouts.

By leveraging **front-end file uploads**, you can create **powerful, interactive CoPilots** that respond intelligently based on user-provided documents. 🚀
