Jump to content

PHP File Upload Giving An Error…Please Give me solution


toorhamza

Recommended Posts

I have created a new webpage on my vps. I installed php mysql and all other stuff now after all the work is done the upload bar does not allows me to upload any file while the same script on wampp is working like a charm.


It says me "There is some errors on upload..."


Here is my website you could test by uploading any small file http://www.replitz.com/ My server php info is here http://www.replitz.com/phpinfo.php


everything is fine and the script was also fine on wampp but still the error is coming on my vps please suggest me any solution.


This is my upload for



<form action="upload.php" method="post" enctype="multipart/form-data">
<center><p> <input type='file' size='58' style='height: 30px; font-size: 18px' name='filename'></p>
<input type='image' src='<?php echo $menu_upload_button; ?>Upload Now'>
</form>

Link to comment
Share on other sites

Ok then here is the upload.php

<?php
include('config.php');
$query = "SELECT * FROM hfm_config WHERE id='central'";
$result = mysql_query($query);
$row = mysql_fetch_array($result);
include('errorloader.php');
if($row['site'] == "3. Base site (example: http://site.com/)") { echo '<br /><center><span style="color:red; font-size: 15px">Site Name is not set. Please, set it in AdminPanel.</span></center> '; } else { }
?>
<!DOCTYPE html>
<!--[if IE 8]> 				 <html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->

<head>
	<meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>Replitz Beta - A File Sharing Service</title>

  
  <link rel="stylesheet" href="css/replitz.css">
  

  <script src="js/vendor/custom.modernizr.js"></script>

</head>
<body>
 <nav class="top-bar">
    <ul class="title-area">
      <!-- Title Area -->
      <li class="name">
        <h1>
          <a href="#">
            Replitz - An Fast Secure and Innovative Way To Share Your Files
          </a>
        </h1>
      </li>
      <li class="toggle-topbar menu-icon"><a href="#"><span>menu</span></a></li>
    </ul>
 
    <section class="top-bar-section">
      <!-- Right Nav Section -->
<ul class="button-group right">
        <li><a href="http://www.replitz.com" class="button">Home</a></li>
        <li><a href="http://www.replitz.com/register.php" class="button">Register</a></li>
        <li><a href="http://www.replitz.com/blog.php" class="button">Blog</a></li>
      </ul>
    </section>
  </nav>
 
  <!-- End Top Bar -->
  
<!-- End Header and Nav -->
 
<!-- First Band (Slider) -->

	<body id="login">	
		<div id="login-container">
	
	<div id="login-content" style="width:600px;">
	
		<div class="module">
			
			<div class="module-head">
			</div>			
			<div class="wrap">
				
				<div class="content">
			<?php 

      if($_FILES["filename"]["name"] == "")
   {
     echo ($error_label_nofile);
	 echo '				</div> <!--close content-->

			</div> <!--close module wrap-->

			<div class="module-footer">
				<div> </div>
			</div>
		
		</div> <!--close module-->

	</div> <!--close login-content-->

</div> <!--close login-container-->
<center><p style=\'font-size: 20px; color:white\'>'.$row['sitename'].' & HostFile Mini © 2010</p>	</body>

</html>';
     exit;
   }
  if($_FILES["filename"]["size"] > 1024*$row['maxsize']*1024)
   {
     echo ($error_label_size_limited);
	 echo '				</div> <!--close content-->

			</div> <!--close module wrap-->

			<div class="module-footer">
				<div> </div>
			</div>
		
		</div> <!--close module-->

	</div> <!--close login-content-->

</div> <!--close login-container-->
<center><p style=\'font-size: 20px; color:white\'>'.$row['sitename'].' & HostFile Mini © 2010</p>	</body>

</html>';
     exit;
   }
   $name_file = $_FILES["filename"]["name"];
   $result_name = uniqid(rand())."-".$name_file;
    $result_namet=strtr($result_name,"àáâãäå¸çèéêëìíîïðñòóôõúûý_",

    "abvgdeeziyklmnoprstufh'iei");

    $result_name=strtr($result_name,"ÀÁÂÃÄŨÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÚÛÝ_",

    "ABVGDEEZIYKLMNOPRSTUFH'IEI");

    // Çàòåì - "ìíîãîñèìâîëüíûå".

    $result_name=strtr($result_name, 

                    array(
" "=>"_", "à"=>"a", "À"=>"A", "á"=>"b", "Á"=>"B", "â"=>"v", "Â"=>"V", "ã"=>"g", "Ã"=>"G", "ä"=>"d", "Ä"=>"D", "å"=>"e", "Å"=>"E", "¸"=>"e", "¨"=>"E", "æ"=>"j", "Æ"=>"J", "ç"=>"z", "Ç"=>"z", "è"=>"i", "È"=>"I", "ê"=>"k", "Ê"=>"K", "ë"=>"l", "Ë"=>"L", "ì"=>"m", "Ì"=>"M", "í"=>"n", "Í"=>"N", "î"=>"o", "Î"=>"O", "ï"=>"p", "Ï"=>"P", "ð"=>"r", "Ð"=>"R", "ñ"=>"s", "Ñ"=>"S", "ò"=>"t", "Ò"=>"T", "ó"=>"u", "Ó"=>"U", "ô"=>"f", "Ô"=>"F", "õ"=>"h", "Õ"=>"H", "ö"=>"c", "Ö"=>"C", "÷"=>"ch", "×"=>"CH",  "ø"=>"sh", "Ø"=>"SH",  "ù"=>"sh", "Ù"=>"SH", "ú"=>"", "Ú"=>"",  "û"=>"i", "Û"=>"I", "ü"=>"", "Ü"=>"",  "ý"=>"e", "Ý"=>"E", "þ"=>"ju", "Þ"=>"JU",  "ÿ"=>"ja", "ß"=>"JA",  " "=>"_",                           

                        "¿"=>"i", "¯"=>"Yi", "º"=>"ie", "ª"=>"Ye"

                        )

             );
   $s = explode(".", $name_file);
$ext = $s[count($s) - 1];
  if(move_uploaded_file ($_FILES["filename"]["tmp_name"], $upload_path.$result_name))
   
   
   {
$one = md5_file($upload_path.$result_name);
$two = sha1_file($upload_path.$result_name);
$uid = uniqid(rand()).uniqid(rand());
$id = uniqid(rand());
$query1 = "INSERT INTO hfm_delete (file, file_uid) VALUES ('$result_name', '$uid')";
	$result1 = mysql_query($query1);
$query2 = "INSERT INTO hfm_files (file, ip, file_delete, id) VALUES ('$result_name', '$name_file', '$uid', '$id')";
	$result2 = mysql_query($query2);

echo '<p>'.$label_link.'   <input type="text" size="70" style="background: #222222; border: 1px; color:white;" onclick="this.focus();this.select();" value="'; if($row['site'] == "3. Base site (example: http://site.com/)") { echo 'Site Name is not set | '; } else { echo $row['site']; } echo 'download.php?_='.$id.'">';
   }
   else
   {
   echo ($error_file_fail);
   }
   

?>
  <!-- Footer -->
  
  <footer class="row">
    <div class="large-12 columns">
      <hr />
      <div class="row">
        <div class="large-6 columns">
          <p>© Copyright Replitz.com</p>
        </div>
        <div class="large-6 columns">
          <ul class="inline-list right">
            <li><a href="#">About Us</a></li>
            <li><a href="#">Find Us</a></li>
          </ul>
        </div>
      </div>
    </div> 
  </footer>
</body>
</html>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.