 |
Results from the most recent live auction are here.
40 members in the live chat room. Join Chat!
| |
06-25-2008, 12:41 AM
|
· #1 | | New Member | "generating" a large file on remote server? Hello. I'd to test large files on my webhost, and was just wondering if there's any way to "generate" a several-gig file on my server, without having to upload one. (because I've been having trouble uploading anything greater than about 2 gigs or so with FireFTP and FrontPage). |
| |
06-27-2008, 03:25 PM
|
· #2 | | NamePros Regular Name: Jim, of course Location: Philadelphia Join Date: Aug 2005
Posts: 558
NP$: 14.30 ( Donate)
| generate_crap.php: PHP Code: <?php
// generate crap script.
//
// make sure you have write permissions.
//
// it'll prolly time out for rediculously large files,
// so if that happens, just run it again with the same
// file name to append more data to the file.
// -Jim
if(!isset($_GET['filename']) || !isset($_GET['filesize']))
{
?><form action="?" method="get">Generate Crap:<br /><br />
<input type="text" name="filename" /> <- filename to create/append data to<br />
<input type="text" name="filesize" /> <- filesize to add (in MB)<br />
<input type="submit" />
</form><?php
}
else
{
echo "Writing data: ( each | = 128 bytes )<br /><br /><div style=\"font-size: 6px; height: 200px; overflow: auto;\">";
$crap = "0123456789ABCDEFFEDCBA98765432100123456789ABCDEFFE DCBA98765432100123456789ABCDEFFEDCBA98765432100123 456789ABCDEFFEDCBA9876543210";
$filename = $_GET['filename'];
$filesize = $_GET['filesize'] * 1048576;
if($f = fopen("./".$filename,"a"))
{
for($i = 0; $i < $filesize; $i+= 128)
{
fwrite($f,$crap);
echo "| ";
ob_flush();
flush();
}
fclose($f);
}
echo "</div><br /><br /><b><u>It's over!</u></b>";
}
This should work. I tested it up to 200MB.
Make sure to remove those spaces that the forum adds to the $crap = .... line. Stupid auto-word-wrap feature or whatever it is adding gaps to my script!
__________________
woop woop
|
| |
06-27-2008, 05:12 PM
|
· #3 | | New Member | Thanks, Jim...
So, if I want to generate a 12 GB file, will this work? (I'm not a coder, so I'm just guessing what I have to put in the file)
Notice also, I turned the $crap = into $crap= (no space), like you mentioned. (I just need to verify this) PHP Code: <?php
// generate crap script.
//
// make sure you have write permissions.
//
// it'll prolly time out for rediculously large files,
// so if that happens, just run it again with the same
// file name to append more data to the file.
// -Jim
if(!isset($_GET['house.avi']) || !isset($_GET['12328']))
{
?><form action="?" method="get">Generate Crap:<br /><br />
<input type="text" name="house.avi" /> <- filename to create/append data to<br />
<input type="text" name="12328" /> <- filesize to add (in MB)<br />
<input type="submit" />
</form><?php
}
else
{
echo "Writing data: ( each | = 128 bytes )<br /><br /><div style=\"font-size: 6px; height: 200px; overflow: auto;\">";
$crap= "0123456789ABCDEFFEDCBA98765432100123456789ABCDEFFE DCBA98765432100123456789ABCDEFFEDCBA98765432100123 456789ABCDEFFEDCBA9876543210";
$filename = $_GET['house.avi'];
$filesize = $_GET['12328'] * 1048576;
if($f = fopen("./".$house.avi,"a"))
{
for($i = 0; $i < $10328; $i+= 128)
{
fwrite($f,$crap);
echo "| ";
ob_flush();
flush();
}
fclose($f);
}
echo "</div><br /><br /><b><u>It's over!</u></b>";
}
...and then when I'm done, I assume I just browse to the generate_crap.php in the browser, and it will run?
Last edited by Dr_Test : 06-27-2008 at 05:16 PM.
|
| |
06-28-2008, 10:58 AM
|
· #4 | | NamePros Regular Name: Jim, of course Location: Philadelphia Join Date: Aug 2005
Posts: 558
NP$: 14.30 ( Donate)
| haha no no no.
Just upload the script as-is, but remove those gaps in the line starting with "$crap = ". No other editing necessary. Then, visit it in your browser and enter the filename and filesize you want into the input boxes and hit submit.
__________________
woop woop
Last edited by Jim_ : 06-28-2008 at 11:02 AM.
|
| |
06-28-2008, 06:35 PM
|
· #5 | | New Member | Ahh, okay... thanks a lot, lol.
It's working beautifully, but after 30 seconds, it stops and spits out this at the bottom of the long text box: Fatal error: Maximum execution time of 30 seconds exceeded in /home/arbie/public_html/generate.php on line 31
I'm guessing my webhost server is disallowing operations longer than 30 seconds, right? (it's Lunarpages, btw)
Any ideas how to get around this, or change it? |
| |
Posting Rules
| You may not post new threads You may not post replies You may not post attachments You may not edit your posts HTML code is Off | | | |