FAQ Database Discussion Community


PHP file size check [closed]

php,filesize
i have this function in funcs.php function checkfilesize() { global $file; global $sizelimit; //var sizelimit is set as integer using settype() if ((isset($file)) && (filesize($file) > $sizelimit)) { echo 'File size > '.$sizelimit.'!'); unlink($file); exit; } else { // } } upload.php includes this file When i delete this function...

Opening large files

c#,filesize,ftpwebrequest
I have a processes I made that has been working well for several months now. The process recursively zips up all files and folders in a given directory and then uploads the zip file to an FTP server. Its been working, but now, the zip file is exceeding 2gb and...

Two XML files. Roughly same number of lines. One is twice the size of the other. How?

xml,vb.net,vba,file-io,filesize
I have been generating an XML sitemap using Access and VBA. I asked our developers to implement a server side solution so that it can be ran every night without me having to remember to do it. I generate the file by writing text to a file. Very simple. My...

How to have two max file size limits on one Magento site

php,magento,file-upload,filesize
So here's my problem. In the admin section of our Magento site, we need the ability upload files that can be anywhere from 2-500 MB's each. I've set my php.ini settings appropriately and all is well with this requirement. But now I've been asked to allow guests to upload files...

Is a 50M jar file reasonable from 5k lines of scala code?

scala,jar,sbt,filesize,sbt-assembly
I'm building a scala project with ~5k lines of code so far. I'm creating a jar file with sbt assembly. It's coming out to 50M, which is much larger than I'd naively expected. Is this a reasonable sort of size or does it sound suspiciously bloated? I'm just hoping for...

How to reduce the size of ear file

spring,maven,websphere,ear,filesize
The size of my EAR file has reached around 100 MB after adding many exetrnal jars. Environment : Java Spring/Websphere application server/Maven Please share the tips to reduce the size of an EAR file. Seems the exteral jars contribute most to the large size. Is it possible to follow an...

Does the App Store remove architectures from an IPA?

ios,app-store,filesize,ipa
Since the announcement by Apple that all apps distributed by the App Store require 64-bit support, I've had to build multiple-architecture fat binaries that increase the size of the resulting IPA. Does this size increase directly affect my users, or does the App Store strip out irrelevant architectures from an...

gem ocra generates huge files

ruby,gem,filesize,ocra
I created a simple ruby script require 'gtk3' def destroy( widget ) Gtk.main_quit end Gtk.init window = Gtk::Window.new :toplevel window.set_title( "helloworld.rb" ) window.set_border_width( 10 ) window.signal_connect( "delete_event" ) { destroy(nil) } button = Gtk::Button.new :label => "Button" window.add( button ) button.show window.show Gtk.main This script creates a very simple GUI...

Getting file size platform-independently (C)

c,file,cross-platform,standards,filesize
I am looking for some platform-independent C code to determine the size of a given file. First, I read the following answer: http://stackoverflow.com/a/238607 The answer uses fseek with SEEK_END and ftell. Now, my problem is that I found the following C standard quotes. Setting the file position indicator to end-of-file,...

How can I find the ratio between two file sizes as a percentage in Python?

python,math,percentage,filesize,ratio
I've written a short Python script to find the original and minified sizes of a script, by comparing file sizes, and to find the difference and compression ratio. The script itself follows: #! /usr/bin/python import os import sys file1 = sys.argv[1] file2 = sys.argv[2] file1Size = os.stat(file1).st_size file2Size = os.stat(file2).st_size...

Can you trust file size given by $_FILES array in PHP?

php,security,post,filesize
Sorry if it is trivial or obvious, but I could not find the answer by googling it. From where does the size value in $_FILES['name'] array come from? Could you trust the value of it ($_FILES['name']['size']) or should you still check it using the filesize() function? In other words, is...

How to check file size before opening in R

r,download,unzip,filesize
How can I check the size of a file before I load it into R? For example: http://math.ucdenver.edu/RTutorial/titanic.txt I'd like to use the optimal command to open a file based on the file's size....

Copy files until they exceed a specified size

powershell,filesize,get-childitem
I need to copy files to a folder until they exceed a specified size. I've written the following script but it fails with the following error: Cannot compare "Microsoft.PowerShell.Commands.GenericMeasureInfo" because it is not IComparable. At C:\33.ps1:8 char:1 + "{0:N2}" -f ($colItems.sum / 1024MB) $files = Get-ChildItem C:\source -Recurse | %...

Concatenate file weight less than the sum of the files

filesize,cat,ls
I have done these commands to concatenate the files into one file: $ ls -1 | wc -l 16916 $ ls -1 *.txt | wc -l 16916 $ ls -lh | head -1 total 93M $ cat *.txt > ../nectar_3.txt $ ls -lh ../nectar_3.txt -rw-r--r-- 1 llopis llopis 52M May...

Warning: filesize(): stat failed for img.jpg

php,filesize
So, I am trying to get the file size of an img and I keep getting this warning. this is what i did: $path = $_FILES['profile']['name']; $path = iconv('UTF-8', 'ISO-8859-1',$path); if (!in_array(pathinfo($path,PATHINFO_EXTENSION),$allowed)) { return "file"; } elseif(filesize($path)>(1024*600)) I am able to get the file extension no problem but the filesize()...

Is there a way to output file size on disk in batch?

file,batch-file,filesize
Is there a way to get the size on disk of a file like in the properties window: I have tried: (inside a batch file) echo %~z1 , for %i in (TestFile.txt) do echo %~zi , dir But they only return the size of the file(s). Is there any way...

Python program to produce dictionary of file extensions and sizes

python,dictionary,filesize,file-extension
I am trying to create a program in Python that will search through a directory of files and create a dictionary whose keys are the various file extensions in the directory, and whose values constitute lists containing the number of times that extension appears in the directory, the size of...

Why does chown increase size of docker image?

docker,filesize,chown,dockerfile
I can't understand why the 'chown' command should increase the size of my docker image? The following Dockerfile creates an image of size 5.3MB: FROM alpine:edge RUN adduser example -D -h /example -s /bin/sh This example however creates an image of size 8.7MB: FROM alpine:edge RUN adduser example -D -h...

PHP file corruption when downloading .jpg files?

php,filesize
When downloading .jpg files via a URL on my site, the file becomes corrupt. I haven't tested a lot of files bu t.pdf's download fine. I'm seeing the following error in the file: b>Warning: filesize() [function.filesize]: stat failed for sunny.jpg in /home/content/91/4761691/html/pages/download.php on line 89 Line 89 is the filesize()...