QJ.NET | Videos | Forums | iPhone | MMORPG | Nintendo DS | Wii | PlayStation 3 | PSP | Xbox 360 | PC | Downloads | Contact Us
Forums | Gaming News | Videos | Downloads | Today's Posts | Mark Forums Read | Chat | FAQ | Members List | Contact

QJ.net Game Discussion - PSP, Xbox, Wii, PS3, PSP Homebrew, and PSP Guides

Go Back   QJ.net Game Discussion - PSP, Xbox, Wii, PS3, PSP Homebrew, and PSP Guides > Consumer > General PC Forums > Everything Windows
The above video goes away if you are a member and logged in, so log in now!

PHP uploader screws up COMPLETELY!

This is a discussion on PHP uploader screws up COMPLETELY! within the Everything Windows forums, part of the General PC Forums category; This is the link: http://savagefreak.007ihost.com/EZUPLOAD/index.php Try to upload something... You will get the other page screwed up completely! It really ...

Reply
 
LinkBack Thread Tools
Old 05-20-2007, 07:50 AM   #1
No longer a community member.
 
Join Date: Jun 2006
Location: Nederland
Posts: 3
Trader Feedback: 0
Default PHP uploader screws up COMPLETELY!

This is the link:
http://savagefreak.007ihost.com/EZUPLOAD/index.php
Try to upload something...
You will get the other page screwed up completely!
It really sucks...
This is the code of upload.php:

PHP Code:
<html>
<head>
<title>Untitled-1</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type-"text/css">

.content { font-size:12px;
font-family:Tahoma, Arial, sans-serif;
color:#FFFFFF;
padding:0px 0px 0px; }
.copy { font-size:8px;
font-family:Tahoma, Arial, sans-serif;
color:#FFFFFF;
padding:0px 0px 0px; }
body { background-color:#afafaf; }
img { border:none; }

</style>
</head>
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<!-- ImageReady Slices (Untitled-1) -->
<table id="Table_01" width="663" height="749" border="0" cellpadding="0" cellspacing="0">
<tr>
  <td colspan="9" background="images/banner.gif" width="663" height="185" alt=""></td>
</tr>
<tr>
  <td colspan="9" background="images/index_02.gif" width="663" height="30" alt=""></td>
</tr>
<tr>
  <td rowspan="8" background="images/index_03.gif" width="16" height="533" alt=""></td>
  <td colspan="2" background="images/index_04.gif" width="12" height="12" alt=""></td>
  <td colspan="4" background="images/index_05.gif" width="553" height="12" alt="">
</td>
  <td background="images/index_06.gif" width="13" height="12" alt=""></td>
  <td rowspan="8" background="images/index_07.gif" width="69" height="533" alt=""></td>
</tr>
<tr>
  <td colspan="2" background="images/index_08.gif" width="12" height="68" alt=""></td>
  <td colspan="4" background="images/upload_field.gif" width="553" height="68" alt="">
<form action="upload.php" method="post" enctype="multipart/form-data">
Browse a File to Upload:<br>
<input type="file" name="filetoupload"><br>
<input type="hidden" name="MAX_FILE_SIZE" value="<?echo $size_bytes; ?>">
<br>
<input type="Submit" value="Upload File">
<?php
/*
Author:  Mohammed Ahmed(M@king)
E-mail:  m at maaking dot com
WWW   :  http://www.maaking.com
*/
//**********************************************************************//
//  $_FILES['filetoupload']  is the value of                            //
// file field from the form. <input type="file" name="filetoupload">    //
//**********************************************************************//
// this is the upload dir where files will go.
//Don't remove the /
//Chmod it (777)
$upload_dir = "images/";   //change to whatever you want.
// files less than 1MB
$size_bytes = 1048576; //bytes  will be uploaded
$limit_file_type = "no"; //Do you want to limit the types of files uploaded. (yes/no)
// specify file types.
$allowed_file_type = array('image/gif',
                          
'image/pjpeg',
                          
'image/jpeg',
                          
'image/png',
                          
'image/jpg');
         
//check if the directory exist or not.
         
if (!is_dir("$upload_dir")) {
     die (
"The directory <b>($upload_dir)</b> doesn't exist");
         }
         
//check if the directory is writable.
         
if (!is_writeable("$upload_dir")){
            die (
"The directory <b>($upload_dir)</b> is NOT writable, Please Chmod (777)");
         }
//Check first if a file has been selected
//is_uploaded_file('filename') returns true if
//a file was uploaded via HTTP POST. Returns false otherwise.
if (is_uploaded_file($_FILES['filetoupload']['tmp_name']))
{
//begin of is_uploaded_file
        //Get the Size of the File
        
$size = $_FILES['filetoupload']['size'];
        
//Make sure that $size is less than 1MB (1000000 bytes)
        
if ($size > $size_bytes)
        {
            echo
"File Too Large. File must be <b>$size_bytes</b> bytes.";
            exit();
        }
             
//check file type
        
if (($limit_file_type == "yes") && (!in_array($_FILES['filetoupload']['type'],$allowed_file_type)))
        {
            echo
"wrong file type";
            exit();
        }
        
// $filename will hold the value of the file name submetted from the form.
        
$filename =  $_FILES['filetoupload']['name'];
        
// Check if file is Already EXISTS.
        
if(file_exists($upload_dir.$filename)){
            echo
"Oops! The file named <b>$filename </b>already exists";
            exit();
        }
        
//Move the File to the Directory of your choice
        //move_uploaded_file('filename','destination') Moves afile to a new location.
        
if (move_uploaded_file($_FILES['filetoupload']['tmp_name'],$upload_dir.$filename)) {
           
//tell the user that the file has been uploaded and make him alink too;).
           
echo "File (<a href=$upload_dir$filename>$filename</a>) uploaded!";
           exit();
        }
        else
        {
            
//Print error
            
echo "There was a problem moving your file";
            exit();
        }
}
//end of is_uploaded_file

?>
</td>
  <td background="images/index_10.gif" width="13" height="68" alt=""></td>
</tr>
<tr>
  <td colspan="2" background="images/index_11.gif" width="12" height="12" alt=""></td>
  <td colspan="4" background="images/index_12.gif" width="553" height="12" alt=""></td>
  <td background="images/index_13.gif" width="13" height="12" alt=""></td>
</tr>
<tr>
  <td colspan="7" background="images/index_14.gif" width="578" height="25" alt="">
<div class="copy">
<i> &copy Savagefreak 2007, all rights reserved.</td>
</div>
</tr>
<tr>
  <td rowspan="4" background="images/index_15.gif" width="8" height="416" alt=""></td>
  <td colspan="4" background="images/index_16.gif" width="503" height="7" alt=""></td>
  <td colspan="2" rowspan="4" background="images/index_17.gif" width="67" height="416" alt=""></td>
</tr>
<tr>
  <td colspan="2" background="images/index_18.gif" width="7" height="228" alt=""></td>
  <td background="images/text_field.gif" width="488" height="228" alt="">
<div class="content">
<h3> Welcome to EZ Upload! </h3> <p>
This is the easyest way to upload images and show them to your friends,
or post them to things like blogs, forums etc.<p>
<b>Rules:</b><br>
Only the formats .JPG, .PNG or .GIF are alowed<br>
2 MB (2048 KB) max.<br>
<i>No pornograhical materials</i><br>
With every upload session you submit we collect your IP,<br>
If you <i>do</i> upload porn or sexual pictures we will give you a IP ban.<p>
Note: Please do not upload one picture more then one time.
</div>
</td>
  <td background="images/index_20.gif" width="8" height="228" alt=""></td>
</tr>
<tr>
  <td colspan="4" background="images/index_21.gif" width="503" height="8" alt=""></td>
</tr>
<tr>
  <td colspan="4" background="images/index_22.gif" width="503" height="173" alt=""></td>
</tr>
<tr>
  <td background="images/spacer.gif" width="16" height="1" alt=""></td>
  <td background="images/spacer.gif" width="8" height="1" alt=""></td>
  <td background="images/spacer.gif" width="4" height="1" alt=""></td>
  <td background="images/spacer.gif" width="3" height="1" alt=""></td>
  <td background="images/spacer.gif" width="488" height="1" alt=""></td>
  <td background="images/spacer.gif" width="8" height="1" alt=""></td>
  <td background="images/spacer.gif" width="54" height="1" alt=""></td>
  <td background="images/spacer.gif" width="13" height="1" alt=""></td>
  <td background="images/spacer.gif" width="69" height="1" alt=""></td>
</tr>
</table>
<!-- End ImageReady Slices -->
</body>
</html>
Note: It DOES upload the files ok.

(I know NOTHING about PHP,
I just wanted to experiment a bit...)
btw, when I leave all the images out it will work but it looks ugly.)
-= Double Post =-
Oh shat.
Could a mod please move this?

Last edited by Savagefreak; 05-20-2007 at 09:50 AM.. Reason: Automerged Doublepost
Savagefreak is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Tags
completely , php , screws , uploader

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



All times are GMT -8. The time now is 03:18 AM.



Use of this Web site constitutes acceptance of the TERMS & CONDITIONS and PRIVACY POLICY
Copyright © 2009, QJ.NET. All Rights Reserved.
Contact Us