Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to change 4MB photo upload limit #789

Closed
andynorton opened this issue Nov 18, 2017 · 29 comments · Fixed by #2127
Closed

Unable to change 4MB photo upload limit #789

andynorton opened this issue Nov 18, 2017 · 29 comments · Fixed by #2127
Assignees
Labels
front-burner p1 Painful if we don't fix, won't block releasing

Comments

@andynorton
Copy link

In WebChat, the limit for “Images” is set to 4MB. This is problematic when using phone cameras to upload images for processing.

@billba
Copy link
Member

billba commented Nov 18, 2017

I don't think that limit is set by WebChat.

@danmarshall
Copy link
Contributor

Hi @andynorton I don't believe we are setting any limit in the client side code, but we have seen similar reports for DirectLine. Can you provide a conversationID so that we can inspect on our server side?

@andynorton
Copy link
Author

An Azure Escalation Engineer said that “For WebChat, the limit for “Images” is set to 5MB. In my testing, I also noticed that the limit is currently 4MB.”

We’ve been unsuccessful when changing web config max file size options.

@billba
Copy link
Member

billba commented Nov 18, 2017

Seriously, the limit is not set by WebChat.

@andynorton
Copy link
Author

Okay thanks for coming back to me, would you have any suggestions on how this might be happening outside of WebChat, as we’ve struggled with anything over 4MB?

@danmarshall
Copy link
Contributor

Please see my comment above

@andynorton
Copy link
Author

andynorton commented Nov 19, 2017

Hi @danmarshall - Conversation ID: AphyPzEXUHlJlBQclkCiqD. We've submitted 3 images under 4MB and 3 over.

@andynorton
Copy link
Author

@danmarshall - is that Conversation ID of any use?

@danmarshall
Copy link
Contributor

Hello @andynorton - there was an error reading the multipart MIME body. Can you please share a file which causes the issue?

@andynorton
Copy link
Author

andynorton commented Nov 27, 2017

Hi @danmarshall - https://1drv.ms/i/s!AkI2BTKSRBbJhLpiIFwFrV-a3z1LAQ

An image over 4mb should cause the issue in our testing.

@danmarshall
Copy link
Contributor

Thanks @andynorton that was very helpful. I've reproduced the error, and it is being limited on the server side in Direct Line. So, 4MB will be the max size limit until further notice. Sorry you had to find out with ad hoc testing, we should publish this in our documentation. Our team will be reviewing the size limit policy.

@andynorton
Copy link
Author

Thanks @danmarshall, we’d love to help out with any testing if this limit is increased in future. Could you post a link to the documentation you mentioned?

@danmarshall
Copy link
Contributor

The documentation we have is for the Direct Line Rest API itself:
https://docs.microsoft.com/en-us/bot-framework/rest-api/bot-framework-rest-direct-line-3-0-send-activity#upload-attachments

But - I do realize that's opaque to you and other Web Chat developers, since you're a downstream consumer of this. You're just using Web Chat, which uses DirectLineJs, which uses the Rest API.

I imagine that we need to support modern phones, which are something of a moving target wrt cameras and photo file sizes.

@danmarshall
Copy link
Contributor

Thanks for the help offer @andynorton :) We welcome your (and the community's) suggestions as to what this limit might be.

@compulim
Copy link
Contributor

I think @andynorton has his point. And we need to think about an API that filter the user upload before sending it to the server.

Like an async call so dev have chances to downscale photos on JS side, or block uploads which doesn't meet some requirements.

@mralnis
Copy link

mralnis commented Feb 19, 2018

Any updates regarding this?
And why this is marked as enhancement? I receive 500 error code from direct line when i try to upload something bigger. This should be marked as bug.

@billba
Copy link
Member

billba commented Feb 20, 2018

This is marked as an enhancement because it is by design.

@mralnis
Copy link

mralnis commented Feb 20, 2018

@billba Should't there be some validation or least a place to hook in your own validation?
Receiving error and chat getting stuck* doesn't feel like by design. And there is now good way that i know to inform customer that file size was too big.

  • Stuck - stopping the chat flow until you type something else.

@billba
Copy link
Member

billba commented Feb 20, 2018 via email

@HainanZhao
Copy link

This is annoying, my new phone camera takes 4K photos by default, the photo size goes up to 9MB easily. And there's no setting to reduce the image resolution. Please fix this. Thanks.

@danmarshall
Copy link
Contributor

FWIW - here's a library that can resize the image prior to uploading: https://github.com/nodeca/pica

@chaha126
Copy link

chaha126 commented Oct 26, 2018

@danmarshall Hi Dan, we are developing a feature which allows our users to attach a media file (image, video, audio etc.) to their notes. Is there any way that we can configure the maximum file attachment size? Otherwise, the file icon on the bottom-left of webchat window will be not so helpful since most files (images, videos etc.) in current phones will exceed 4MB.

FYI, when I test the bot using Bot Emulator, it seems that it has a higher limit as I can upload 100MB files successfully.

@compulim
Copy link
Contributor

compulim commented Apr 8, 2019

When I upload a 16.3 MB file, the server returned 500. Looks like our server has some hard limits.

HTTP/1.1 500 Internal Server Error
Cache-Control: no-cache
Pragma: no-cache
Content-Length: 51
Content-Type: application/json; charset=utf-8
Expires: -1
Server: Microsoft-IIS/10.0
Access-Control-Allow-Origin: *
Strict-Transport-Security: max-age=31536000
Date: Mon, 08 Apr 2019 17:34:51 GMT

{
  "error": {
    "code": "ServiceError"
  }
}

@compulim
Copy link
Contributor

compulim commented Apr 8, 2019

Looks like we are using the default value for attachment limit (4 MB).

I can upload a 3.999 MB file (1 KB short of 4 MB). But I cannot upload a 4 MB minus 1 byte file.

@compulim
Copy link
Contributor

compulim commented Apr 13, 2019

I don't think we will change this value. Will need to find a way (write a sample) for Web Chat users to upload files using their our storage, e.g. blob storage with SAS key.

Recommend to postpone to 4.5.

@Aleimar
Copy link

Aleimar commented Oct 30, 2020

Hi, it's now 2020 (almost 2021). Do we have an update about file size limit now?

@zhaoxing-msft
Copy link

I don't think we will change this value. Will need to find a way (write a sample) for Web Chat users to upload files using their our storage, e.g. blob storage with SAS key.

Recommend to postpone to 4.5.

Hi, @compulim do we now support uploading by user's storage, if yes, could you give me a ref link? thanks

@sebastianstephan
Copy link

It is annoying, that this tiny limit is still in place. When can we expect to have larger file support for WebChat over DirectLine that tiny 4MB? Is there an update on that limitation?

@bradrlaw
Copy link
Member

@zhaoxing-msft What some clients have done is upload their file to blob storage from their web client / mobile app and then attach the URL to the activity to send to the bot. This had several advantages to manage the life cycle / access control of the file. In many cases, the bot needs to send the file to other backend services and having it already in blob storage makes that easier.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
front-burner p1 Painful if we don't fix, won't block releasing
Projects
None yet
Development

Successfully merging a pull request may close this issue.