filesize

s3 direct upload restricting file size and type

送分小仙女□ 提交于 2019-11-27 03:46:18
A newbie question but I have googled abit and can't seem to find any solution. I want to allow users to directly upload files to S3, not via my server first. By doing so, is there any way the files can be checked for size limit and permitted types before actually uploading to S3? Preferably not to use flash but javascript. stonyau If you are talking about security problem (people uploading huge file to your bucket), yes, You CAN restrict file size with browser-based upload to S3. Here is an example of the "policy" variable, where "content-length-range" is the key point. "expiration": "'.date(

file input size issue in safari for multiple file selection

天大地大妈咪最大 提交于 2019-11-27 03:28:28
问题 I am experiencing inconsistencies with regard to multiple file upload in Safari 5.1 on Windows Vista (haven't tried other platforms). The input element has the multiple flag to allow selection of multiple files. The problem occurs when the user does actually select more then one file. In this case, each File has a size attribute of 0 . If (still with the multiple flag), the user only chooses one file, the size attribute correctly contains the file size. The problem can be seen in the

Converting file size in bytes to human-readable string

删除回忆录丶 提交于 2019-11-27 02:36:12
I'm using this function to convert a file size in bytes to a human-readable file size: function getReadableFileSizeString(fileSizeInBytes) { var i = -1; var byteUnits = [' kB', ' MB', ' GB', ' TB', 'PB', 'EB', 'ZB', 'YB']; do { fileSizeInBytes = fileSizeInBytes / 1024; i++; } while (fileSizeInBytes > 1024); return Math.max(fileSizeInBytes, 0.1).toFixed(1) + byteUnits[i]; }; However, it seems like this isn't 100% accurate. For example: getReadableFileSizeString(1551859712); // output is "1.4 GB" Shouldn't this be "1.5 GB" ? It seems like the division by 1024 is losing precision. Am I totally

android reduce file size for camera captured image to be less than 500 kb

核能气质少年 提交于 2019-11-27 02:35:12
问题 My requirement is to upload camera captured image to the server, but it should be less than 500 KB. In case, if it is greater than 500 KB, it needs to be reduced to the size less than 500 KB (but somewhat closer to it) For this, I am using the following code - @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { try { super.onActivityResult(requestCode, resultCode, data); if (resultCode == getActivity().RESULT_OK) { if (requestCode == REQUEST_CODE_CAMERA) {

why is the output of `du` often so different from `du -b`

社会主义新天地 提交于 2019-11-27 01:25:51
why is the output of du often so different from du -b ? -b is shorthand for --apparent-size --block-size=1 . only using --apparent-size gives me the same result most of the time, but --block-size=1 seems to do the trick. i wonder if the output is then correct even, and which numbers are the ones i want? (i.e. actual filesize, if copied to another storage device) Apparent size is the number of bytes your applications think are in the file. It's the amount of data that would be transferred over the network (not counting protocol headers) if you decided to send the file over FTP or HTTP. It's

How to achieve smaller size of the executable?

寵の児 提交于 2019-11-26 20:00:48
问题 Very recently I have come back to Delphi after a long pause and written a rather straightforward utility app my client requested to support an older release... I know these days the size does not matter much, but it struck me as odd that the one-unit application, when compiled, amounted to 1'084'416 b executable. The one and only .pas unit I wrote is some 20.8k large, mostly because of the richness of the gui. The uses clause is as follows: uses Windows, Messages, SysUtils, Variants, Classes,

Git: show total file size difference between two commits?

自古美人都是妖i 提交于 2019-11-26 18:52:25
问题 Is it possible to show the total file size difference between two commits? Something like: $ git file-size-diff 7f3219 bad418 # I wish this worked :) -1234 bytes I’ve tried: $ git diff --patch-with-stat And that shows the file size difference for each binary file in the diff — but not for text files, and not the total file size difference. Any ideas? 回答1: git cat-file -s will output the size in bytes of an object in git. git diff-tree can tell you the differences between one tree and another.

How do you get the file size in C#?

為{幸葍}努か 提交于 2019-11-26 18:46:38
I need a way to get the size of a file using C#, and not the size on disk. How is this possible? Currently I have this loop foreach (FileInfo file in downloadedMessageInfo.GetFiles()) { //file.Length (will this work) } Will this return the size or the size on disk? Marcin Deptuła FileInfo.Length will return the length of file, in bytes (not size on disk), so this is what you are looking for, I think. If you have already a file path as input, this is the code you need: long length = new System.IO.FileInfo(path).Length; FileInfo.Length will do the trick (per MSDN it "[g]ets the size, in bytes,

PHP post_max_size overrides upload_max_filesize

穿精又带淫゛_ 提交于 2019-11-26 18:44:36
In my site host, I have seen (via phpinfo) that post_max_size = 8Mb upload_max_filesize = 16Mb This led me to think that I should be able to upload as file as big as 16Mb. However, when I do this through a post method (as normal), post_max_size takes over and declares that I sent too much. What is the method which permits sending a file as big as 16Mb ? GET - PUT - other ? Hope someone can clarify this for me. Simon Matthew upload_max_filesize is the limit of any single file. post_max_size is the limit of the entire body of the request, which could include multiple files. Given post_max_size =

How can I check the size of a file in a Windows batch script?

南笙酒味 提交于 2019-11-26 18:38:34
I want to have a batch file which checks what the filesize is of a file. If it is bigger than %somany% kbytes, it should redirect with GOTO to somewhere else. Example: [check for filesize] IF %file% [filesize thing Bigger than] GOTO No echo Great! Your filesize is smaller than %somany% kbytes. pause exit :no echo Um... You have a big filesize. pause exit If the file name is used as a parameter to the batch file, all you need is %~z1 (1 means first parameter) If the file name is not a parameter, you can do something like: @echo off setlocal set file="test.cmd" set maxbytesize=1000 FOR /F