I am building an API with Spray that accepts file uploads.
Typically the files will range in size from 100kb to 1mb.
Is it possible with spray to limit file uploads to below this size so that anything bigger is rejected?
Thanks
Look at the spray-can settings. https://github.com/spray/spray/blob/master/spray-can/src/main/resources/reference.conf#L327 You can set spray.can.server.request-chunk-aggregation-limit which will make spray-can only try to collect incoming data up to the given limit and fails the connection otherwise.
Related
Our main app allows our users to post media (videos and images) as well as documents on the timeline with a file size limit of 500 megabytes on a timeline.
We're currently working on a Share Extension to allow users to share files throughout the OS to that timeline. However we're running into the issue that the Share Extension has a hard memory limit of 120 megabytes.
The current implementation in our main app requires that the files selected by the user get converted to a Data object before getting compressed and then uploaded to the API via multipart form data. However to achieve this we must load the files into memory where we run into the hard memory limit.
Apple documentation is very brief and there's not a lot to be found on SO or elsewhere on how to achieve this. There are some workarounds found by storing these files (or references) in UserDefaults and then opening the main app to handle them but that kind of defeats the purpose of sharing something quickly via the extension.
What would be a way around this limit to allow us to upload these large files?
Late to this question I ran into the same issue now. The issue is the memory limit imposed by Apple on File extensions, so you can not use a data object in memory if that object is more than around 50 - 100 MB. I changed the upload to an NSURLSessionUploadTask uploadTaskWithRequest:fromFile:completionHandler:, where I upload the file from the file system directly. If you can not change that you need to provide the multipart form data and boundaries in the delegate of uploadTaskWithStreamedRequest: but consider that also here you can not read the whole file at once but have to stream it as well.
Is there a way to limit the signer attachment file size in docusign, either using the API or through settings at the DocuSign web site. I have read (in the API guide) that there is a 25 MB limit for attachments. Is there any way to restrict this to a smaller number?
Curiously, the document that triggered this issue was 31 MB in size. Our customer was able to upload a document that big, but our application experienced timeout issues because it took too long to download it. Why was the customer able to upload such a big attachment?
Thanks.
[1] No there is not currently a way that outside applications could limit the platform wide limit of ~25MB per envelope that DocuSign has in place. It is recommended that you add logic to your app/integration that checks the file size BEFORE you make the API call to create the envelope and stops the user from using that document if it's too large.
[2] The reason why a particular 30MB document was accepted by the platform but other 30MB documents might error out is due to encryption. Whenever you create a new DocuSign envelope the system automatically encrypts and hashes each document. This in turn bloats the envelope larger. The true limit of the platform is actually 50MB per envelope, so based on the actual data and bytes of your docs different ones will be enlarged to different sizes, and some will exceed that 50MB limit whereas others might not.
Hello All I want to upload files to my external system using SOAP APIs. My requirements -
upload large files to third party system using SOAP API.
File size can be of 250GB.
Limitation that can restrict me -
maximum file size that can be uploaded - 5MB
maximum Heap size - 6MB. even if i want to upload usign SOAP API i will still need to hold blob value in controller.
maximum web service reqquest limit - one of the main issues that i feel is 3MB limit on webservice call out, in this case i can not send SOAP request of more than 3MB.
Please help me out on this tricky solution. let me know if any further details required.
Thanks,
Ray
On my asp.net mvc 4 site I have a feature where a user can upload a photo, via standard file uploader. The photo gets saved in to a file table within sql server.
I have run in to an issue recently where users are uploading very large photos which in return means bandwidth being eaten up when image is being rendered.
What is the best way to handle this? Can I restrict the size of file being uploaded? Or is there a way of reducing the number of bytes being uploaded while maintaining quality?
Refer to this post for the maximumRequestLength config setting and way to provide a more friendly error
This question and answer may also be helpful
You can also check the size of the file in javascript before uploading so that it doesn't even get sent to the server if it is too big (the code below check for anything bigger than 15MB):
if( Math.floor( file.size / 1024 /1024 ) >= 15 )
{
alert( 'File size is greater than maximum allowed. Please make sure that the file is smaller than 15 MegaBytes.' );
return false;
}
Alternatively, on the server side you can use WebImage.Resize() to resize once the file has been uploaded. It won't help with the bandwidth during upload, but it will make subsequent downloads a lot faster. Making an image smaller will cause some loss in quality, but generally it does a good job, just make sure that you choose the option to maintain the aspect ratio to prevent distortion.
As for reducing the bytes before uploading there isn't any way I know of to do this in the browser. You could provide a separate client-side application that will resize the files for them before the upload using the WebImage.Resize method in you app.
We have a web application that is supposed to work offline on iPads. It's using manifest to define which files need to be cached. The point is that we have reached the 10MB limit the iPad has to store those files, and we need to add even more files to the list.
Is there any workaround to increase this limit, or store the files in any other way? Note that going native is not an option at this moment.
You could take a look at this.
Try repeating the process of increasing the manifest in chunks less than 5MB before updating the cache with window.applicationCache.update() and you should be able to pass the 10mb limit
as i understand you can do trick like this:
cache.manifest is a file generated with PHP, on first generation it returns file list less then 5Mb and sets a cookie flag. client side script on 'cached' event checks if cookie set and calls window.applicationCache.update() so PHP code runs again it checks if cookie set and return full cache.manifest file, updates cookie flag