Can't upload file to Zoho Docs using API

Can't upload file to Zoho Docs using API

    Hi

    I am using the free version of Zoho Docs and trying to upload a file into the root folder using PHP and the Docs API.

    My source code is as below:

    1. <?php
    2. $cipher = 'rsa_aes_128_sha';
    3. $AUTHTOKEN=" .... ";
    4. $path=" ... ";
    5. $filename=" ... ";

    6. $url = "https://apidocs.zoho.com/files/v1/upload?authtoken=".$AUTHTOKEN."&scope=docsapi";

    7. $fields = array(
    8.             'filename' => $filename,
    9.             'content' => file_get_contents($path."/".$filename)
    10.         );

    11. $ch = curl_init();

    12. $query = http_build_query($fields);

    13. curl_setopt($ch, CURLOPT_POST, TRUE);
    14. curl_setopt($ch, CURLOPT_POSTFIELDS, $query);
    15. curl_setopt($ch, CURLOPT_URL, $url);
    16. curl_setopt($ch, CURLOPT_SSL_CIPHER_LIST, $cipher);
    17. curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);

    18. $result .= curl_exec($ch);
    19. echo $result;
    20. curl_close($ch);
    21. ?>

    The result is sometimes a properly formed response which says 'Invalid URL' and sometimes a bizarre string that just says:
    1. <!--$Id$ -->

    The URL format appears to match that shown in the API specification. There are some other possible parameters, but these are clearly stated to be optional.

    I have checked that the filename and path are correct, the file has proper permissions and the file contents are being read okay, and query string being constructed properly. The file size is well under the maximum 100M. Other Docs API functions work okay with the same AuthToken.

    What might be going wrong with the file upload?

        Zoho Campaigns Resources


          • Desk Community Learning Series


          • Digest


          • Functions


          • Meetups


          • Kbase


          • Resources


          • Glossary


          • Desk Marketplace


          • MVP Corner


          • Word of the Day


          • Ask the Experts


            • Sticky Posts

            • [Announcement] Insert image from URL changes in Zoho Writer

              Hi Zoho Writer users! We'd like to let you know that we've changed the behavior of the Insert image from URL option in Zoho Writer for security reasons. Earlier behavior Once you inserted an image URL in a Writer document, the image would be fetched from
            • Deprecation of certain URL patterns for published Zoho Writer documents

              Hi Zoho Writer users! We'd like to let you know that we have deprecated certain URL patterns for published and embedded documents in Zoho Writer due to security reasons. If the published or embedded documents are in any of these URL patterns, then their
            • Introducing plagiarism checker in Zoho Writer

              Zia, Zoho Writer's AI-driven writing assistant, now highlights plagiarized and duplicated content in addition to offering contextual grammar and writing suggestions to help you write clearly and concisely in English. Zoho Writer's plagiarism reports Here
            • [Important announcement] Impact of Google's new email guidelines for Zoho Writer automation users

              Hi users, Google has recently announced new guidelines for sending emails to Gmail and other Google-hosted domains. These guidelines will be effective starting Feb. 1, 2024, and can impact the delivery of emails sent from Zoho Writer. Your organization
            • Transitioning from MS Word to Writer: A complete walkthrough

              Hello everyone! We understand moving to a new word processing tool can be difficult, especially if it means switching from a legacy software like MS Word. That's why we've organized an exclusive webinar where we talk you through ways to make your switch from MS Word to Writer as easy as possible. In this webinar, you'll learn: - Why Writer is a simple yet powerful alternative to MS Word. - How to locate your favorite MS Word features and functions in Writer.  - How to migrate your Word documents

            Zoho CRM Plus Resources

              Zoho Books Resources


                Zoho Subscriptions Resources

                  Zoho Projects Resources


                    Zoho Sprints Resources


                      Zoho Orchestly Resources


                        Zoho Creator Resources


                          Zoho WorkDrive Resources



                            Zoho CRM Resources

                            • CRM Community Learning Series

                              CRM Community Learning Series


                            • Tips

                              Tips

                            • Functions

                              Functions

                            • Meetups

                              Meetups

                            • Kbase

                              Kbase

                            • Resources

                              Resources

                            • Digest

                              Digest

                            • CRM Marketplace

                              CRM Marketplace

                            • MVP Corner

                              MVP Corner




                              Zoho Writer Writer

                              Get Started. Write Away!

                              Writer is a powerful online word processor, designed for collaborative work.

                                Zoho CRM コンテンツ



                                  ご検討中の方

                                    • Recent Topics

                                    • Invalid collection string

                                      I haven't changed anything in one of my functions. I'm trying to run it manually and suddenly "Invalid collection string" appears. My code has 6 lines and the error says that the error is on 7th line. Why? What does this error mean? Nothing has been changed
                                    • Zoho Directory 2025: New Features | Security Enhancements | Enriched UI

                                      Hello everyone, Greetings from the Zoho Directory team! 2025 has been a highly successful year for Zoho Directory. We are delighted to introduce a fresh set of features, an enriched UI, and major product enhancements. These updates aim to deliver a smoother
                                    • Bulk Schedule for Posting TikTok

                                      Hallo, We have a client whose business is a social media agency specifically TikTok. Currently they are handling 30 TikTok accounts from. I think zoho Social can handle it with Agency License + with Add on 10 Brands. Their concern is related to posting
                                    • zoho people 5 report

                                      How do I customize my report in Zoho People Report? I understand that I can get the results of multi-table queries through SQL join statements, but I don't know the relationship between each table. I tried to create a report using Attendance User Report
                                    • Leave Report Emailed Weekly

                                      I am wondering if someone knows how to have a report generated either weekly or monthly or both for department heads and ownership of upcoming employee leave. For instance, it would be nice to get an emailed report on Friday for the upcoming week of who
                                    • Ability to Edit YouTube Video Title, Description & Thumbnail After Publishing

                                      Hi Zoho Social Team, How are you? We would like to request an enhancement to Zoho Social that enables users to edit YouTube video details after the video has already been published. Your team confirmed that while Zoho Social currently allows editing the
                                    • Zoho Flow Decision Continuing Despite Not Meeting Conditions

                                      I have a picklist field called Lead Status in the leads module, with the following lead Statuses: New Lead Attempted Contact - 1 Attempted Contact - 2 Attempted Contact - 3 Attempted Contact - 4 Attempted Contact - 5 Attempted Contact - 6 Attempted Contact
                                    • Add RTL and Hebrew Support for Candidate Portal (and Other Zoho Recruit Portals)

                                      Dear Zoho Recruit Team, I hope you're doing well. We would like to request the ability to set the Candidate Portal to be Right-to-Left (RTL) and in Hebrew, similar to the existing functionality for the Career Site. Currently, when we set the Career Site
                                    • zoho labels api not working

                                      We're using n8n to automte email reply using zoho api. I'm facing issue with label api. I added the required scopes but its not working. i followed zoho api documentation but didn't work. also, where do i find/how do i create zoho oauth token mentioneeed
                                    • Zoho Books Sandbox environment

                                      Hello. Is there a free sandbox environment for the developers using Zoho Books API? I am working on the Zoho Books add-on and currently not ready to buy a premium service - maybe later when my add-on will start to bring money. Right now I just need a
                                    • Tip #55- Accessibility Controls in Zoho Assist: Exploring Vision Settings- 'Insider Insights'

                                      As we approach the end of the year, it’s a good moment to reflect on how we can make our tools more inclusive and easier to use for everyone. Remote support often involves long hours in front of screens, varied lighting conditions, and users with different
                                    • Zoho Recruit Slow and Freezing on all screens

                                      We have had an issue with Zoho Recruit for weeks being extremely slow and at times freezing.  We have 100 mega internet, and I went into each computer and updated the virtual memory so there is more available.  Also restarted all computers daily.  Still having the issues.  Almost unable to work.
                                    • Credit Management: #2 Configuring Right Payment Terms for Credit Control

                                      Think about the last time you ordered something online and saw that little note at the checkout, "Pay on Delivery" or "Pay later". It's simple, but it actually sets the tone. As a business owner, you know exactly when payment is expected. Now, imagine
                                    • Dependent (Conditional) Fields in Zoho Bookings Forms

                                      Hello Zoho Bookings Team, Greetings, We would like to request the ability to create dependent (conditional) fields in Zoho Bookings registration forms. Current Limitation: There is currently no way to make one field’s available options depend on the value
                                    • Bug Report: Search fails to find existing notes after Evernote import

                                      Hello, I recently migrated from Evernote (~2600 notes across 23 notebooks), but the search functionality is currently broken. The Issue: I can manually browse to a specific note and see it exists. However, when I type the exact or partial title of that
                                    • Marketing Tip #13: Win repeat customers with post-purchase emails

                                      The relationship with your customer doesn’t end after the sale; that’s when it begins. A thoughtful post-purchase message shows customers you appreciate them, keeps your brand top of mind, and can even lead to another sale. You can thank them, ask for
                                    • Zoho Form

                                      I have problem with Zoho Form. One of form i don't received the PDF version. Others okay except this one. W904533
                                    • Create & Update Zoho Vault Passwords via Zoho Flow

                                      Hi Zoho Flow / Zoho Vault Team, We’d like to request an enhancement to the Zoho Vault integration in Zoho Flow. Current Limitation: At the moment, Zoho Flow supports only the following selected Zoho Vault actions, such as: Fetch passwords, Share passwords
                                    • Is Zoho Communityspaces now part of Zoho One?

                                      Is Zoho Communityspaces now part of Zoho One?
                                    • Streams/Shared email doesn't show up in windows trident app. It works fine on MAC. Is there any difference between 2 install ?

                                      I can see streams/share email boxs on my MAC version of trident app but i can't see them in windows version of trident app. Is there any difference between 2 install? I try to find setting but not able to see any setting to add stream/share email boxes.
                                    • Credit Note for Shipped and Fatoora pushed invoices

                                      We have shipped a Sales Order and created an Invoice. The Invoice is also pushed to Fatoora Now we need to create a credit note for the invoice When we try it, it says we need to create a Sales Return in the Zoho Books, we have already created a Sales
                                    • Cliq iOS can't see shared screen

                                      Hello, I had this morning a video call with a colleague. She is using Cliq Desktop MacOS and wanted to share her screen with me. I'm on iPad. I noticed, while she shared her screen, I could only see her video, but not the shared screen... Does Cliq iOS is able to display shared screen, or is it somewhere else to be found ? Regards
                                    • MCP no longer works with Claude

                                      Anyone else notice Zoho MCP no longer works with Claude? I'm unable to turn this on in the claude chat. When I try to toggle it on, it just does nothing at all. I've tried in incognito, new browsers, etc. - nothing seems to work.
                                    • Custom Related List Inside Zoho Books

                                      Hello, We can create the Related list inside the zoho books by the deluge code, I am sharing the reference code Please have a look may be it will help you. //..........Get Org Details organizationID = organization.get("organization_id"); Recordid = cm_g_a_data.get("module_record_id");
                                    • Features, Feedback and Votes

                                      We’re launching the Feedback Forum for our customers. This is 'THE' place where you can add everything you’d like to see in Zoho Books. If you don't find the specific feature you need, simply add it so others can also vote for it. While we cannot promise
                                    • add zoho account

                                      How to add a zoho mail to previous zoho account? I have two
                                    • There Might Be A Glitch in Determining If A String Represents A URL

                                      I suspect there might be a glitch in determining if a string represents a URL or not. For example, I cannot embed the following URL. Perhaps the exclamation mark or parentheses are the culprit? https://en.wikipedia.org/wiki/How_the_Grinch_Stole_Chri
                                    • Customer Management: #4 Enhance Customer Journey

                                      When Neha started DefineOps, a growing IT support and consulting firm, most of her work was straightforward. A client would sign up for a free version, decide whether the service works for them, and then either continue or discontinue. Billing was simple,
                                    • Pipeline.Company Name field shows up as numbers! [Bigin Developer Console > Component > URL]

                                      Hi there, I am setting up to invoke URL to send infromation zoho bigin > zoho forms with company name pre-fill in the form. however when I use : ${Pipelines.Company Name} field it shows up as a string of number instead of words. Help.
                                    • Marketing Tip #1: Optimize item titles for SEO

                                      Your item title is the first thing both Google and shoppers notice. Instead of a generic “Leather Bag,” go for something detailed like “Handcrafted Leather Laptop Bag – Durable & Stylish.” This helps your items rank better in search results and instantly
                                    • Territory Assignment Issues (Lead to Account + Contact)

                                      1. Lead → Account & Contact Territory Assignment on Conversion A Lead is automatically assigned one or more territories using a workflow and Lead Assignment Rules. This works as expected, and we are able to assign multiple territories to a Lead automatically.
                                    • Marketer's Space: Proven tips to improve open rates – Part II

                                      Hello Marketers! Welcome back to another post in Marketer's Space! We're continuing from where we left off a fortnight ago. We ended the previous post discussing the subject line, and we'll continue from there. Let's dive right in. Pre-header Pre-header
                                    • SQL Table slowed to a crawl

                                      Hi all - I seem to have noticed an update. Now whenever I am typing in the script field for the SQL tables there is a huge delay and it is all very slow. This has never been the case for me in over 5 years of using Analytics - I really hope it's fixed
                                    • Deluge Events/search API works in user environment but not in sandbox – why?

                                      I am creating an Extension for Zoho CRM using Zoho Sigma Platform I’m using the following Deluge code to search Events in Zoho CRM based on Start_DateTime: criteria = "(Start_DateTime:greater_than:2025-12-20T00:00:00+00:00)"; url = "crm/v8/Events/search?criteria="
                                    • Ensure Consistent Service Delivery with Comprehensive Job Sheets

                                      We are elated to announce that one of the most requested features is now live: Job Sheets. They are customizable, reusable forms that serve as a checklist for the services that technicians need to carry out and as a tool for data collection. While on
                                    • What are Zoho Meeting capabilities included in Zoho Workplace Standard?

                                      I am evaluating using Zoho Meeting for my organization, but it is not clear what Zoho Meeting capabilities are already included in Zoho Workplace Standard. - Are meeting recordings included in Workplace Standard? - Can we invite external meeting participants
                                    • Create static subforms in Zoho CRM: streamline data entry with pre-defined values

                                      Last modified on (9 July, 2025): This feature was available in early access and is currently being rolled out to customers in phases. Currently available for users in the the AU, CA, and SA DCs. It will be enabled for the remaining DCs in the next couple
                                    • How can I get the participant list of a reoccurring meeting afterwards?

                                      I'm trying to use the Meeting Participant Report from the API docs but when I call it on a reoccurring meeting it returns that there are no participants because it thinks I'm talking about the meeting in the future. Is there a way to use webhooks or some
                                    • Function #50: Send Mass emails to your customers

                                      Hello everyone, and welcome back to our series! We have reached a milestone of 50 Functions, which means that we have automated 50 different tasks in Zoho Books. Every Friday, we have shared a nifty function aimed at either automating a task or streamlining
                                    • Full Hebrew Language Support for Client-Side Zoho Assist Interface

                                      Dear Zoho Assist Team, We would like to request an enhancement to Zoho Assist's client-side interface to support full Hebrew language customization, including all popups, notifications, and session-related messages. Current Limitation The Join page allows
                                    • Next Page