We recently had a client request for improvement to a form where the specific size of a file upload was causing a problem. This meant that to test our use cases properly, I needed some files to upload that were specific sizes:
ie, a file that was greater than 2MB but less than 32MB.
ie, a file that was greater than 32MB but less than 256MB.
ie, a file that was greater than 256MB but less than 512MB.
I read a really useful post on how to generate test files of particular file size on the common OS platforms on Stottmeister's Blog that proved quite useful for me.
mkfile <file size> <filename>
mkfile 40M testfile.txt
dd if=/dev/zero of=<filename> bs=<initial blocksize in bytes> count=<iterations of the blocksize>
dd if=/dev/zero of=testfile.txt bs=28M count=1
C:\>fsutil file createnew <filename> <filesize in bytes>
C:\>fsutil file createnew C:\testfile.txt 1024
The process to create these files is pretty quick too - so it's much easier to generate a test file than to search around your hard drive for a file of appropriate size. Not to mention - if you work with many clients; you don't want to be uploading files that belong to other clients just so you can test a use case.