Setting maximum upload size with deform.widget.FileUploadWidget - pyramid

How one can limit maximum upload size with deform.widget.FileUploadWidget() so that the validation fails with a friendly error message if the file is too large?

Maybe this code from Kotti can help. The answer seems to be a custom validator.

Related

Set nodejs express response size

I have done this before somewhere but I can't find where anymore. My problem is, my response.send(myJSON) is too big (the myJSON is too big) so my content get cut off before it reaches the user. How can I set the response.send() to a bigger size or unlimited even?
you can use the npm package express-response-size to customize response of the server.

How can I get the length of a video in node.js

My backend needs to check to see if a video is under 60 seconds, or else it doesn't add the link to the database. Is there any easy solution if I have the file on disk? Something simple like videofile.getDuration()
I checked out FFMEG on npm but I'm not sure if that's what I need or if that's even up to date.
I use ffprobe for the task.
If you follow the README and you get to read the streams' info you will be able to get the duration by accessing the following tag on the video stream:
info.streams[0].tags.DURATION
There might be variants according to the kind of video file you are parsing, this example works with mkv.

Has Yesod setMessage function a size limit?

I'm using Yesod and I'm experiencing a strange bug.
I'm uploading csv file and when the format is incorrect I display as a message (using setMessage) the uploaded file with some error message. When the file is too big, I don't get any message at all, as if I didn't set the message (or the message has been discarded).
I'm pretty sure the problem is on my side, but ss it possible that setMessage a size limit and discart too big message ? I guess setMessage uses session or something and it might have some restrictions .

How do I set the File Expire Header with Rackspace CloudFiles .NET API

I'm trying to set X-Delete-After and X-Delete-At to a file i'm uploading.
So i tired :
FileMetaData.Add("X-Delete-After", "30");
cloudFilesProvider.UpdateObjectMetadata(inStrContainerID, strDesFileName, FileMetaData);
but the header did not get recognized.
is that the right approach?
Edit: I'm trying to use ICloudFilesMetadataProcessor.ProcessMetadata, but really have no clue how to and am not able to find any documentation.
In the current release of the SDK, you can include the X-Delete-After or X-Delete-At value in the headers argument to the following calls:
IObjectStorageProvider.CreateObject
IObjectStorageProvider.CreateObjectFromFile
Currently there is no way in the SDK to change the value of this header after the file has already been uploaded (e.g. using UpdateObjectMetadata as you suggest in the question would set the values X-Object-Meta-X-Delete-After or X-Object-Meta-X-Delete-After, which is not correct).
Here is a related issue on GitHub:
#167: How to assign version folder
Gopstar --
EDITED:
After more investigation; I set the X-Delete-After to 1500 and the code worked. Sort of. When viewing the file header information via the dashboard, the X-Delete-At was set.
However, the result was correct; the X-Delete-At was equal to what would be 1500 seconds from the time I set it.
Original reply:
I played around; if you set the value higher (for example, I tried X-Delete-After = 3000) it will work.
I do NOT know the lowest number acceptable, but I'm sure someone will chime in with the number.
Hope this give SOME help.

Customize AWStats Downloads

This seems ridiculous to me, but AWStats is not configured to count exe or dmg files as downloads. What config file or setting can I change? I tried looking through the documentation but found no mention of anything pertaining to Downloads.
I did find out to add another download section containing my file types here http://antezeta.com/news/awstats, but neither the hits or bandwidth calculations are even close to being correct.
Add an extra section to the end of the awstats.config file. The following example counts *.dmg files:
ExtraSectionName1="Disk Image Downloads"
ExtraSectionCodeFilter1="200 304"
ExtraSectionCondition1="URL,\.dmg"
ExtraSectionFirstColumnTitle1="File"
ExtraSectionFirstColumnValues1="URL,(.*)"
ExtraSectionFirstColumnFormat1="%s"
ExtraSectionStatTypes1=HB
ExtraSectionAddAverageRow1=0
ExtraSectionAddSumRow1=1
MaxNbOfExtra1=100
MinHitExtra1=1
Bandwidth counted is unlikely to match file size times download count. Many downloads will not complete or will be interrupted.

Resources