web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

Failed to load resource: the server responded with a status of 413 ()

(2) ShareShare
ReportReport
Posted on by 97
Failed to load resource: the server responded with a status of 413 ()
 
when i try to send the file to my custom service size grater than 30 mb the server responce 
Failed to load resource: the server responded with a status of 413 () 
 
how to increase the maxrecevingfilesize of the d365 fo service. 
 
i dont know how to  bypass this limit.
Categories:
I have the same question (0)
  • Martin Dráb Profile Picture
    237,965 Most Valuable Professional on at
    This seems to be closely related to your previous thread, the server responded with a status of 413 () while attaching grater than 5 mb file.
        
    It's a pity that you've ignored my advice about providing more information about your problem. We can't help you give us no or wrong information.
      
    Please tell us what you're doing (e.g. whether it's still about an extensible contol), show us your code (both the custom service and how you call it) and give us more details about the error.   
     
    I'm pretty sure that custom services can accept larger files, therefore I suspect you didn't test it correctly. The problem ​​​​​​likely is in how you're calling the service,.     
         
    The answer to your question "How to increase the maxrecevingfilesize of the d365 fo service?" is simple: you cannot, therefore forget this idea. You could change things like web.config in your development environment, but it would be useless, because you can't do that in production.  
  • Suggested answer
    CU28111010-1 Profile Picture
    97 on at
     
    the below code is my custom service code 
     
     public void uploadFile(FileUploadRequest request)
     {
                   
         DocuRef docuRef = this.createDocuRefFromCommon(request);
         DocuActionFile docuActionFile = DocuAction::newDocuRef(docuRef);
         str filename, ext, path;
         [path,Filename,ext] = fileNameSplit(request.parmFileName());
      
         System.Byte[] messageBytes = System.Convert::FromBase64String(request.parmbase64());
         System.IO.MemoryStream memoryStream = new System.IO.MemoryStream(messageBytes);
         if(docuRef)
         {
             docuActionFile.attachFile(docuRef,request.parmFileName(), ext,memoryStream);
         }
        
     }
     public DocuRef createDocuRefFromCommon(FileUploadRequest req)
     {
        changecompany('USMF')
        {
            DocuRef docuRef;
            HIQ_dragdrop dragdrop;
           
            select firstonly dragdrop;
        
            docuRef.clear();
            docuRef.RefTableId = dragdrop.ReferenceTableId;
            docuRef.RefRecId = dragdrop.ReferenceRecId;
            docuRef.RefCompanyId = dragdrop.DataAreaId;
            docuRef.Name = req.parmFileName();
            docuRef.TypeId = "File";
            docuRef.insert();
            docuRef.reread();
            return docuRef;
        }
     }
     
    and this is where i call my custom service 
     
    try
    {
        const apiResponse = await fetch("https://usnconeboxax1aos.cloud.onebox.dynamics.com/api/services/FileUpload/FileUploadService/UploadFile", {
            method: 'POST',
            headers: {
                'Authorization': `Bearer ${token}`,
                'Content-Type': 'application/json'
            },
            body: JSON.stringify(payload)
        });
        if (apiResponse.ok) {
            console.log("File uploaded successfully");
        }
    }
    catch (error)
    {
        console.error("fetch error", error);
    }
     
    this code is my custom dragdrop contol's javascript code and first time i try to attach the grater than 30 mb file it attach perfectly and i try another time it through 413 error 
     
    if you want i will share my full javascript code 
     
    and the below is my responce i get 
     
    second time try to attach the rebind error is through
  • Verified answer
    Martin Dráb Profile Picture
    237,965 Most Valuable Professional on at
    The whole idea looks wrong to me. Form controls aready runs in the context of a user sessions, therefore routing requests from your control to other parts of F&O through internet just makes everything much more complicated, slower and less secure.
     
    Let me tell you that F&O already contains the logic for importing files, therefore there is no need to developing it once more. Use what's already there; then it doesn't matter you're unable to develop it on your own. The control is called FileUpload (the control class has the same name). The import itself is then handled by classes inheriting from FileUploadStrategyBase, such as DocuUploadStrategy.
     
    The difference between drag & drop and selecting a file in a dialog is just in how you define the input for data upload. Uploading is the same.
     
    Also, as already mentioned in another thread of yours, the drag & drop logic is already available in E-ttach - Drag and Drop for D365 F&O - Free Version, therefore you can possible avoid all development.
     
    By the way, please use Suggested answer for replies that don't (attempt to) answer the question that the thread is about.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 503 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 434 Super User 2025 Season 2

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 278 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans