Stick Page Forums Archive

Free File Uploader

Started by: zymn | Replies: 23 | Views: 872

Deathwish
2

Posts: 3,793
Joined: May 2006
Rep: 10

View Profile
Jul 28, 2008 10:39 PM #200651
Quote from hj
Why did you trash my birthday thread Deathwish ;_;
YOU B**** >=O

lol


Because you're an idiot.
And don't play your mouth or I'll ban you : D

Back on topic, dreamweaver or are you coding it in a text editor?
zymn
Banned

Posts: 913
Joined: Apr 2007
Rep: 10

View Profile
Jul 28, 2008 11:19 PM #200675
text editor.
don't have enough money for dreamweaver.

i got the whole upload code from a site, but now i'm editing it to my liking.

and, sorry it was down there for a while. i was editing it, and something went wrong...

anyways, its all fixed and stuff.
and, so, how would i incorporate the name into the file?
Deathwish
2

Posts: 3,793
Joined: May 2006
Rep: 10

View Profile
Jul 28, 2008 11:35 PM #200686
Quote from zymn
text editor.
don't have enough money for dreamweaver.

i got the whole upload code from a site, but now i'm editing it to my liking.

and, sorry it was down there for a while. i was editing it, and something went wrong...

anyways, its all fixed and stuff.
and, so, how would i incorporate the name into the file?


Good, dreamweaver is laame.

Anyway, copy paste the code you have now in a code box please and i'll take a look.
[code*][/code] without the stars.
zymn
Banned

Posts: 913
Joined: Apr 2007
Rep: 10

View Profile
Jul 28, 2008 11:43 PM #200692



High Ends - Uploader


 


 


 








 



function display_upload_form()
{
echo <<









Pick a File Already.













DISPLAY_UPLOAD_FORM;
}

// File Upload ****************************************************************

function execute_upload()
{
// root path
$path = $_SERVER['DOCUMENT_ROOT'];

// upload directory. path will originate from root.
$dirname = '/zymn/uploads/';

// permission settings for newly created folders
$chmod = 0755;

// create file vars to make things easier to read.
$filename = $_FILES['myfile']['name'];
$filesize = $_FILES['myfile']['size'];
$filetype = $_FILES['myfile']['type'];
$file_tmp = $_FILES['myfile']['tmp_name'];
$file_err = $_FILES['myfile']['error'];
$file_ext = strrchr($filename, '.');

// check if user actually put something in the file input field.
if (($file_err == 0) && ($filesize != 0))
{
// Check extension.
if (!$file_ext)
{
unlink($file_tmp);
die('File must have an extension.');
}

// extra check to prevent file attacks.
if (is_uploaded_file($file_tmp))
{
/*
* check if the directory exists
* if it doesnt exist, make the directory
*/
$dir = $path . $dirname;

if (!is_dir($dir))
{
$dir = explode('/', $dirname);

foreach ($dir as $sub_dir)
{
$path .= '/' . $sub_dir;
if (!is_dir($path))
{
if (!mkdir($path, $chmod))
{
unlink($file_tmp);
die('Error: Directory does not exist and was unable to be created.');
}
}
}
}

/*
* copy the file from the temporary upload directory
* to its final detination.
*/
if (@move_uploaded_file($file_tmp, $dir . '/' . $filename))
{
// success!
echo "

Done. Be happy.


View Your Stupid Friggin File: $filename



";
}
else
{
// error moving file. check file permissions.
unlink($file_tmp);
echo 'Error: Unable to move file to designated directory.';
}
}
else
{
// file seems suspicious... delete file and error out.
unlink($file_tmp);
echo 'Error: File does not appear to be a valid upload. Could be a file attack.';
}
}
else
{
// Kill temp file, if any, and display error.
if ($file_tmp != '')
{
unlink($file_tmp);
}

switch ($file_err)
{
case '0':
echo 'That is not a valid file. 0 byte length.';
break;

case '1':
echo 'This file, at ' . $filesize . ' bytes, exceeds the maximum allowed file size as set in php.ini. '.
'Please contact your system admin.';
break;

case '2':
echo 'This file exceeds the maximum file size specified in your HTML form.';
break;

case '3':
echo 'File was only partially uploaded. This could be the result of your connection '.
'being dropped in the middle of the upload.';

case '4':
echo 'You did not upload anything... Please go back and select a file to upload.';
break;
}
}
}

// Logic Code *****************************************************************

if (isset($_POST['execute']))
{
execute_upload();
}
else
{
display_upload_form();
}


?>







and, new banner.
Index
2

Posts: 7,352
Joined: Jun 2007
Rep: 10

View Profile
Jul 29, 2008 12:38 AM #200717
Hmm... I uploaded a file, and I hate how it makes it on some kind of zoom view.
zymn
Banned

Posts: 913
Joined: Apr 2007
Rep: 10

View Profile
Jul 29, 2008 12:59 AM #200723
thats because its a direct link. i don't like it either, but i don't know how to make it maybe like a portal.
Schwa
2

Posts: 3,807
Joined: Jul 2007
Rep: 10

View Profile
Jul 29, 2008 2:10 AM #200750
Why don't you look at the code on the antiup site?

And for the record, the banner is hideous. Just make it text without ugly stickfigures.

Also, change the text style from the default times new roman, find a font that looks cool and then use this code I think.

and then put a on at the end of the text.

Or you could use a style sheet.

Also, PM me your code.

Also, again, this doesn't seem like a good idea, because you're using a free webhost which have really small limits on file size, so if people start using it you get ****ed.
zymn
Banned

Posts: 913
Joined: Apr 2007
Rep: 10

View Profile
Jul 29, 2008 2:19 AM #200760
HAHA.
the site host is by beta. and i talk to him on msn. and... well... i don't think there is a file limit on this. it was supposed to be 10 mb, but i've uploaded much higher than that. and...

where do i put these?


if($_FILES['myfile']['size'] > 1048576) {
die('ERROR: 1 MB file limit');
}
?>



$allowed_ext = array('doc','txt','rtf'); //add file extensions here...
$ext = end(explode('.',$_FILES['myfile']['name']);
if(!in_array($ext,$allowed_ext)){
die('File extension not allowed');
}
?>


into this:


function display_upload_form()
{
echo <<









Pick a File Already.







Types Allowed: jpg, swf, gif, png, fla, zip, rar, txt, mp3, wav

Size Limit: 50 MB










DISPLAY_UPLOAD_FORM;
}

// File Upload ****************************************************************

function execute_upload()
{
// root path
$path = $_SERVER['DOCUMENT_ROOT'];

// upload directory. path will originate from root.
$dirname = '/zymn/uploads/';

// permission settings for newly created folders
$chmod = 0755;

// create file vars to make things easier to read.
$filename = $_FILES['myfile']['name'];
$filesize = $_FILES['myfile']['size'];
$filetype = $_FILES['myfile']['type'];
$file_tmp = $_FILES['myfile']['tmp_name'];
$file_err = $_FILES['myfile']['error'];
$file_ext = strrchr($filename, '.');

// check if user actually put something in the file input field.
if (($file_err == 0) && ($filesize != 0))
{
// Check extension.
if (!$file_ext)
{
unlink($file_tmp);
die('File must have an extension.');
}

// extra check to prevent file attacks.
if (is_uploaded_file($file_tmp))
{
/*
* check if the directory exists
* if it doesnt exist, make the directory
*/
$dir = $path . $dirname;

if (!is_dir($dir))
{
$dir = explode('/', $dirname);

foreach ($dir as $sub_dir)
{
$path .= '/' . $sub_dir;
if (!is_dir($path))
{
if (!mkdir($path, $chmod))
{
unlink($file_tmp);
die('Error: Directory does not exist and was unable to be created.');
}
}
}
}

/*
* copy the file from the temporary upload directory
* to its final detination.
*/
if (@move_uploaded_file($file_tmp, $dir . '/' . $filename))
{
// success!
echo "

Done. Be happy.


View Your Stupid Friggin File: $filename



";
}
else
{
// error moving file. check file permissions.
unlink($file_tmp);
echo 'Error: Unable to move file to designated directory.';
}
}
else
{
// file seems suspicious... delete file and error out.
unlink($file_tmp);
echo 'Error: File does not appear to be a valid upload. Could be a file attack.';
}
}
else
{
// Kill temp file, if any, and display error.
if ($file_tmp != '')
{
unlink($file_tmp);
}

switch ($file_err)
{
case '0':
echo 'That is not a valid file. 0 byte length.';
break;

case '1':
echo 'This file, at ' . $filesize . ' bytes, exceeds the maximum allowed file size as set in php.ini. '.
'Please contact your system admin.';
break;

case '2':
echo 'This file exceeds the maximum file size specified in your HTML form.';
break;

case '3':
echo 'File was only partially uploaded. This could be the result of your connection '.
'being dropped in the middle of the upload.';

case '4':
echo 'You did not upload anything... Please go back and select a file to upload.';
break;
}
}
}

// Logic Code *****************************************************************

if (isset($_POST['execute']))
{
execute_upload();
}
else
{
display_upload_form();
}


?>
zymn
Banned

Posts: 913
Joined: Apr 2007
Rep: 10

View Profile
Jul 29, 2008 11:11 PM #201349
UPDATE!

added an affiliate and email page.
Website Version: 1.0.4
© 2025 Max Games. All rights reserved.