13 Replies - 480 Views - Last Post: 15 September 2013 - 06:48 AM Rate Topic: -----

#1 chris98  Icon User is offline

  • D.I.C Addict

Reputation: 21
  • View blog
  • Posts: 802
  • Joined: 06-July 13

Upload problem; uploading not working.

Posted 15 September 2013 - 03:15 AM

I have created an upload system, which I will paste below.

It works perfectly, apart from one small thing; the file upload only works for file sizes smaller than roughly 1000 KB.

I do have size restrictions, but they are 250 MB.Could someone tell me what I could do to actually make it upload larger files?

This is the only thing which won't work on it.

Every time I try, it just comes up with the "unspecified error".What have I dne wrong to get it to not upload them?

Are the sizes I am trying to upload too big; if so, how, as the restriction is 250 MB?

And if it is, how could I let it upload larger files?

(This is the full code, though the relevant part starts about 100 lines in)

<?php
		 //Start:: Other Files Required?
		 define('PUN_ROOT', dirname(__FILE__).'/../../');
		 include PUN_ROOT.'include/common.php';
		 define('PUN_ROOT', '/');
		 require_once('db/db_connection.php');
		 //End:: Other Files Required?
		 
		 if (isset($_POST['submitBtn_search'])) {
$search = (isset($_POST['search'])) ? ($_POST['search']) : '' ;
header("Location:  ../show_results.php?search=".$search."");
}
		 
		 //Start:: Guests shouldn't be here
		 if ($pun_user['is_guest'])
		 header("location: ../../login.php");
		 //End:: Guests shouldn't be here
		 
		 //Start:: Submitted Form?
		 if (isset($_POST['submitBtn'])) {
		 //End:: Submitted Form?
		 
		 //Start:: Get all relevant variables
		 //Start | Get User ID & name
		 $user_id = "".$pun_user['id']."";
		 $username = "".($pun_user['username'])."";
		 //End: | Get User ID & name
		 //Start | Upload locations?
		 $minimap_uploadLocation = "c:/wamp/www/stronghold2nation/downloads/files/minimaps/\\";
		 $uploadLocation = "c:/wamp/www/stronghold2nation/downloads/files/downloads/\\";
		 //End | Upload locations?
		 //Start | Uploaded File names
		 $minimap  =   "".  basename( $_FILES['upfile']['name'])."";
         $file  =   "".  basename( $_FILES['ufile']['name']).""; 
		 //End | Uploaded File names
		 //Start | Get current date
		 $date  =  "".date("d/m/Y")."";
		 //End | Get current date
		 //Start | Get all other variables in order of fields
		 $category     = (isset($_POST['data_name'])) ? htmlentities($_POST['data_name']) : '' ;
		 $name     = (isset($_POST['name'])) ? htmlentities($_POST['name']) : '' ;
		 $estates     = (isset($_POST['estates'])) ? htmlentities($_POST['estates']) : '' ;
		 $text  = (isset($_POST['area1'])) ? ($_POST['area1']) : '' ;
		 $difficulty     = (isset($_POST['difficulty'])) ? htmlentities($_POST['difficulty']) : '' ;
		 $balance     = (isset($_POST['balanced'])) ? htmlentities($_POST['balanced']) : '' ;
		 $size     = "" . ($_FILES["ufile"]["size"] / 1024) . " KB";
         $email    = (isset($_POST['email'])) ? htmlentities($_POST['email']) : '' ;
		 $missions     = (isset($_POST['missions'])) ? htmlentities($_POST['missions']) : '' ;
		 $support     = (isset($_POST['support'])) ? htmlentities($_POST['support']) : '' ;
		 //End | Get all other variables in order of fields
		 //End:: Get all relevant variables
		 
		 //Start:: Stop empty required fields
		 if (empty($category)) {
		 exit ('You must select a category.');
		 }
		 if (empty($name)) {
		 exit ('You must enter a filename.');
		 }
		 if (empty($estates)) {
		 exit ('You must select the amount of Estates on your map.If you are uploading a Miscellaneous file, select the bottom option.');
		 }
		 if (empty($text)) {
		 exit ('You must enter a file description bigger than 5 charcters.');
		 }
		 if (empty($difficulty)) {
		 exit ('You must select the difficulty of your file.If you are uploading a Miscellaneous file, choose the difficulty of installing it instead.');
		 }
		 if (empty($balance)) {
		 exit ('You must select the balance of your map.If you are uploading a Miscellaneous file, select the bottom option.');
		 }
		 if (empty($missions)) {
		 exit ('You must select the number of missions of your map.If you are uploading a Miscellaneous file, select the bottom option.');
		 }
		 if (empty($file)) {
		 exit ('You must upload a Zip file.');
		 }
		 //End:: Stop empty required fields
		 
		 //Start:: Minimap Verification
		 //Start | Preview Size
if (($_FILES["upfile"]["size"] > 102400)) // Max File Size: 100KB
  {
  exit ('Your preview image is too big.Please try again.');
  }
//End | Preview Size
//Start | Allowed Previews
$allowed[] = 'gif';
$allowed[] = 'bmp';
$allowed[] = 'jpg';
$allowed[] = 'jpeg';
$allowed[] = 'png';
$allowed[] = '';  
  $filename = basename( $_FILES['upfile']['name']);
  $ext = substr($filename, strrpos($filename, '.')+1 , 3);
  $ext = strtolower($ext);

  if (!in_array($ext, $allowed)) {
        exit('This type of file extension is not allowed.Please upload a valid preview image.');
  }
//End | Allowed Previews
//Start | Allow No Preview & Preview Exist?
if (!empty($minimap)) {
$filename_check2 = "../files/minimaps/".$minimap."";
if (file_exists($filename_check2)) {
    exit ('The preview image you are uploading already exists.Please specify a different name, then try again.');
};  
}
//End | Allow No Preview & Preview Exist?  
//End:: Minimap Verification 

//Start:: Zip file Verification
//Start | File Size
if (($_FILES["ufile"]["size"] > 262144000)) // Max File Size: 250MB
  {
  exit ('Your file size is too big.Please try again.');
  }
//End | File Size
//Start | File allowed?
$allowed1[] = 'zip';
  $filename_2 = basename( $_FILES['ufile']['name']);
  $ext1 = substr($filename_2, strrpos($filename_2, '.')+1 , 3);
  $ext1 = strtolower($ext1);

  if (!in_array($ext1, $allowed1)) {
        exit('This type of file extension is not allowed.Please upload a zip file.');
  }
//End | File allowed?
//Start | File Already Exists?
$filename_check = "../files/downloads/".$file."";
if (file_exists($filename_check)) {
    exit ('The zip file you are uploading already exists.Please specify a different name, and try again.');
};
//End | File Already Exists?
//End:: Zip file Verification

//Start:: Right, if everything is fine, upload it all
//Start | Upload Minimap
$target_path = $minimap_uploadLocation . basename( $_FILES['upfile']['name']);
if(move_uploaded_file($_FILES['upfile']['tmp_name'], $target_path)) {
};
//End | Upload Minimap
//Start | Upload Zip File
$target_path1 = $uploadLocation . basename( $_FILES['ufile']['name']);
if(!move_uploaded_file($_FILES['ufile']['tmp_name'], $target_path1)) {
    exit ('There was an unspecified error uploading the zip file.Please try again.');
}
//End | Upload Zip File
//Start | Add info to Database
$sql = "INSERT INTO downloads_unchecked (name,username,userid,size,text,minimap,date,file,category,email,difficulty,balanced,estates,support,missions) VALUES (
			 :name,:username,:userid,:size,:text,:minimap,:date,:file,:category,:email,:difficulty,:balance,:estates,:support,:missions)";
$ps = $pdo->prepare($sql);
$ps->execute(array(':name'=>$name,
':username'=>$username,
':userid'=>$user_id,
':size'=>$size,
':text'=>$text,
':minimap'=>$minimap,
':date'=>$date,
':file'=>$file,
':category'=>$category,
':email'=>$email,
':difficulty'=>$difficulty,
':balance'=>$balance,
':estates'=>$estates,
':support'=>$support,
':missions'=>$missions));			 
//End | Add info to Database
//Start | Uploaded fine?
exit ('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
<html>
<head>
<center>   <title>Thank You!</title>
   <link href="style/style.css" rel="stylesheet" type="text/css" />
   <link href="style/button.css" rel="stylesheet" type="text/css" />
   <link rel="stylesheet" type="text/css" href="style/style2.css" />
</head>
<body>
    <div id="page">
      <div id="pagetop">
        <div class="links">    	
            <ul>
            </ul>
        </div>
     </div>
      <div id="main">
        <div id="formheader">Thank you!<a href="../index.php">Return to the Index</a></div>
        <div id="formbody">
            <table align="center">
			  <tr><th>Thank you for taking your time to submit a file to Stronghold 2 Nation.As soon as our staff have checked your upload, it will appear on our site, which normally takes between 24-48 hours.If you have entered an email, you will get an email once we have checked it! <br><br>Have a good day,<br>
			  <i>The StrongholdNation team</i></th></td></tr>
            </table>  
          </form>

        </div>
        <div id="source"></div>	
      </div>
</body>');
//End | Uploaded fine?
//End:: Right, if everything is fine, upload it all          
    } 
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="application/xhtml+xml; charset=iso-8859-1" />
<title>Download Central :: Stronghold 2 Nation</title>
<link href="../stylesheet.css" rel="stylesheet" type="text/css" />
<link href="../gb_styles.css" rel="stylesheet" type="text/css" />
</head>
<script src="../nicEdit.js" type="text/javascript"></script>
<script type="text/javascript">bkLib.onDomLoaded(nicEditors.allTextAreas);</script>
<body>

<div id="overDiv" style="position:absolute; visibility:hidden; z-index:1000;"></div>
<div id="wrapper">

  <a href="http://stronghold2.strongholdnation.co.uk"><div id="header">
   <div id="topmenu">
    <ul>

    </ul>
   </div>
  </div>
  </a>
	<div id="content">

		<div id="posts">
			<div class="post">
				<p>
				</p>
				<br /><br />
<div class="upload">
 <table width="0%" cellspacing="0" cellpadding="0">
        </table>
        
        <div id="outer_box"><br />
        <h1 class="upload">Submit a File (Step 2 of 2)</h1>          			  
		<br /><br />
<h2>Add your file to Stronghold 2 Nation!<br><br>Required Fields are marked with an Asterisk (*)Your filename must be greater than (>) 2 characters, and your description > 5</h2><br><br>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" name="fileform" id="fileform" enctype="multipart/form-data">

			  <b>Category:*</b>&nbsp;<select name="data_name">
<option value="">--Please Select Your Category--</option>
<option value="Peace Custom">Peace Custom</option>
<option value="Free Build">Free Build</option>
<option value="Kingmaker">Kingmaker</option>
<option value="Custom War">Custom War</option>
<option value="Miscellaneous">Miscellaneous</option>
</select><br><br>
<b>File Name:*</b><br><input name="name" type="text" size="42" maxlength="25" /><br><br>
<b>Preview Image:</b><br><font size="1">Your preview image must be no bigger than 100KB, and must either be a PNG, JPEG, BMP or GIF image.<br>It will also automatically get sized to 200x200 pixels</font size><br><input class="text" name="upfile" type="file" size="36"><br><br>
<b>No of Estates:*</b><br><select name="estates"><option value="">--Please Select Your Value--</option><option value="1">1</option>
   <option value="2">2</option>
   <option value="2">2</option>
   <option value="3">3</option>
   <option value="4">4</option>
   <option value="5">5</option>
   <option value="6">6</option>
   <option value="7">7</option>
   <option value="8">8</option>
   <option value="9">9</option>
   <option value="10">10</option>
   <option value="11">11</option>
   <option value="12">12</option>
   <option value="13">13</option>
   <option value="14">14</option>
   <option value="15">15</option>
   <option value="16">16</option>
   <option value="17">17</option>
   <option value="18">18</option>
   <option value="N/A">N/A (miscellaneous only)</option>
 </select><br><br>
              <b>Full Description of your File:*</b><br><textarea name="area1" rows="15" width="400"></textarea><br><br>
              <b>Difficulty: *</b><br><select name="difficulty"><option value="">--Please Select Your Value--</option><option value="Very Easy">Very Easy</option>
   <option value="Easy">Easy</option>
   <option value="Normal">Normal</option>
   <option value="Hard">Hard</option>
   <option value="Very Hard">Very Hard</option>
   <option value="Insane">Insane</option>
 </select><br><br>
				<b>Balanced?*</b><br><select name="balanced"><option value="">--Please Select Your Value--</option><option value="Balanced">Balanced</option>
   <option value="Unbalanced">Unbalanced</option>
   <option value="N/A">N/A (Miscellaneous only)</option>
 </select><br><br>
			  <b>File:*</b><br>Your file must be in "zip" form, and no bigger than 250 MB.<br><input class="text" name="ufile" type="file" id="ufile" size="36"><br><br>
              <b>Email:</b><br><input name="email" type="text" size="42" /><br><br>
			  <b>Missions:*</b><br><select name="missions"><option value="">--Please Select Your Value--</option><option value="1">1</option>
   <option value="2">2</option>
   <option value="2">2</option>
   <option value="3">3</option>
   <option value="4">4</option>
   <option value="5">5</option>
   <option value="6">6</option>
   <option value="7">7</option>
   <option value="8">8</option>
   <option value="9">9</option>
   <option value="10">10</option>
   <option value="11">11</option>
   <option value="12">12</option>
   <option value=">12">>12 (Greater than 12)</option>
   <option value="N/A">N/A (Miscellaneous only)</option>
 </select><br><br>
			  <b>Website URL:</b><br><input name="support" type="text" size="50" /><br><br>
			  Here you can enter the URL to a website with additional information/support for this file, e.g. a topic in our download forum. If this page is not related at all (e.g. your personal homepage), the link will be removed.<br>If you link to a <a href="http://www.microsoft.com/en-gb/security/online-privacy/phishing-faq.aspx" title="Exernal link to Microsoft.com">phishing</a> or dangerous site, your account will get terminated.
              <br><br/><input class="text" type="submit" name="submitBtn" value="Upload My File" class="text"/>
            </table>  
          </form>		
			  

                </div>
             	


</div>					  
                    
					
       
				<p>&nbsp;</p>
			</div>
		</div>

		    <div id="form_area" class="boxed">
			<h2 class="heading">Quick Search</h2>
			<div class="content">
				<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
					<div>
			<label>Filename:<br /></label>
            <input type="text" class="textfield" name="search" value="" size="18" /><br /><br />
						<input class="button" name="submitBtn_search" type="submit" value="Search" title="Search" /><br /><br />
						&bull; <a href="../ad_search.php">Advanced Search</a>
					</div>
				</form>
			</div>
		</div>


This post has been edited by chris98: 15 September 2013 - 03:18 AM


Is This A Good Question/Topic? 0
  • +

Replies To: Upload problem; uploading not working.

#2 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 3541
  • View blog
  • Posts: 10,238
  • Joined: 08-June 10

Re: Upload problem; uploading not working.

Posted 15 September 2013 - 03:21 AM

hm, what are your upload ini settings?
Was This Post Helpful? 0
  • +
  • -

#3 chris98  Icon User is offline

  • D.I.C Addict

Reputation: 21
  • View blog
  • Posts: 802
  • Joined: 06-July 13

Re: Upload problem; uploading not working.

Posted 15 September 2013 - 03:28 AM

I think this is them:

$allowed1[] = 'zip';
  $filename_2 = basename( $_FILES['ufile']['name']);
  $ext1 = substr($filename_2, strrpos($filename_2, '.')+1 , 3);
  $ext1 = strtolower($ext1);

  if (!in_array($ext1, $allowed1)) {
        exit('This type of file extension is not allowed.Please upload a zip file.');
  }



if (($_FILES["ufile"]["size"] > 262144000)) // Max File Size: 250MB
  {
  exit ('Your file size is too big.Please try again.');
  }



$filename_check = "../files/downloads/".$file."";
if (file_exists($filename_check)) {
    exit ('The zip file you are uploading already exists.Please specify a different name, and try again.');
};



$target_path1 = $uploadLocation . basename( $_FILES['ufile']['name']);
if(!move_uploaded_file($_FILES['ufile']['tmp_name'], $target_path1)) {
    exit ('There was an unspecified error uploading the zip file.Please try again.');
}



$uploadLocation = "c:/wamp/www/stronghold2nation/downloads/files/downloads/\\";



$file  =   "".  basename( $_FILES['ufile']['name']).""; 


Was This Post Helpful? 0
  • +
  • -

#4 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 3541
  • View blog
  • Posts: 10,238
  • Joined: 08-June 10

Re: Upload problem; uploading not working.

Posted 15 September 2013 - 03:39 AM

Quote

I think this is them:

nope. you totally missed the point.

I was asking about your PHP configuration (aka php.ini)
Was This Post Helpful? 0
  • +
  • -

#5 chris98  Icon User is offline

  • D.I.C Addict

Reputation: 21
  • View blog
  • Posts: 802
  • Joined: 06-July 13

Re: Upload problem; uploading not working.

Posted 15 September 2013 - 03:40 AM

So what are php.ini settings then?
Was This Post Helpful? 0
  • +
  • -

#6 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 3541
  • View blog
  • Posts: 10,238
  • Joined: 08-June 10

Re: Upload problem; uploading not working.

Posted 15 September 2013 - 03:41 AM

run this function in a separate script: phpinfo()
Was This Post Helpful? 0
  • +
  • -

#7 chris98  Icon User is offline

  • D.I.C Addict

Reputation: 21
  • View blog
  • Posts: 802
  • Joined: 06-July 13

Re: Upload problem; uploading not working.

Posted 15 September 2013 - 03:46 AM

I think this is all of it (If i've done it right)







; Whether to allow HTTP file uploads.
; http://php.net/file-uploads
file_uploads = On

; Temporary directory for HTTP uploaded files (will use system default if not
; specified).
; http://php.net/upload-tmp-dir
upload_tmp_dir = "c:/wamp/tmp"

; Maximum allowed size for uploaded files.
; http://php.net/upload-max-filesize
upload_max_filesize = 2M

;;;;;;;;;;;;;;;;;;
; Fopen wrappers ;
;;;;;;;;;;;;;;;;;;

; Whether to allow the treatment of URLs (like http:// or ftp://) as files.
; http://php.net/allow-url-fopen
allow_url_fopen = On

; Whether to allow include/require to open URLs (like http:// or ftp://) as files.
; http://php.net/allow-url-include
allow_url_include = Off

; Define the anonymous ftp password (your email address). PHP's default setting
; for this is empty.
; http://php.net/from
;from="john@doe.com"

; Define the User-Agent string. PHP's default setting for this is empty.
; http://php.net/user-agent
;user_agent="PHP"

; Default timeout for socket based streams (seconds)
; http://php.net/default-socket-timeout
default_socket_timeout = 60

; If your scripts have to deal with files from Macintosh systems,
; or you are running on a Mac and need to deal with files from
; unix or win32 systems, setting this flag will cause PHP to
; automatically detect the EOL character in those files so that
; fgets() and file() will work regardless of the source of the file.
; http://php.net/auto-detect-line-endings
;auto_detect_line_endings = Off

;;;;;;;;;;;;;;;;;;;;;;
; Dynamic Extensions ;
;;;;;;;;;;;;;;;;;;;;;;

; If you wish to have an extension loaded automatically, use the following
; syntax:
;
;   extension=modulename.extension
;
; For example, on Windows:
;
;   extension=msql.dll
;
; ... or under UNIX:
;
;   extension=msql.so
;
; ... or with a path:
;
;   extension=/path/to/extension/msql.so
;
; If you only provide the name of the extension, PHP will look for it in its
; default extension directory.
;
; Windows Extensions
; Note that ODBC support is built in, so no dll is needed for it.
; Note that many DLL files are located in the extensions/ (PHP 4) ext/ (PHP 5)
; extension folders as well as the separate PECL DLL download (PHP 5).
; Be sure to appropriately set the extension_dir directive.
; 
;extension=php_bz2.dll
;extension=php_curl.dll
;extension=php_dba.dll
extension=php_mbstring.dll
;extension=php_exif.dll
;extension=php_fileinfo.dll
extension=php_gd2.dll
;extension=php_gettext.dll
;extension=php_gmp.dll
;extension=php_intl.dll
;extension=php_imap.dll
;extension=php_interbase.dll
;extension=php_ldap.dll
;extension=php_ming.dll
;extension=php_mssql.dll
extension=php_mysql.dll
extension=php_mysqli.dll
;extension=php_oci8.dll      
;extension=php_oci8_11g.dll 
;extension=php_openssl.dll
;extension=php_pdo_firebird.dll
;extension=php_pdo_mssql.dll
extension=php_pdo_mysql.dll
;extension=php_pdo_oci.dll
;extension=php_pdo_odbc.dll
;extension=php_pdo_pgsql.dll
extension=php_pdo_sqlite.dll
;extension=php_pgsql.dll
;extension=php_phar.dll
;extension=php_pspell.dll
;extension=php_shmop.dll
;extension=php_snmp.dll
;extension=php_soap.dll
;extension=php_sockets.dll
;extension=php_sqlite.dll
;extension=php_sqlite3.dll
;extension=php_sybase_ct.dll
;extension=php_tidy.dll
;extension=php_xmlrpc.dll
;extension=php_xsl.dll
;extension=php_zip.dll


Was This Post Helpful? 0
  • +
  • -

#8 andrewsw  Icon User is offline

  • Fire giant boob nipple gun!
  • member icon

Reputation: 3488
  • View blog
  • Posts: 11,902
  • Joined: 12-December 12

Re: Upload problem; uploading not working.

Posted 15 September 2013 - 03:51 AM

So what does it say on line 12?

Mind you, this looks like you've run this script locally, rather than from the server.

This post has been edited by andrewsw: 15 September 2013 - 03:54 AM

Was This Post Helpful? 1
  • +
  • -

#9 chris98  Icon User is offline

  • D.I.C Addict

Reputation: 21
  • View blog
  • Posts: 802
  • Joined: 06-July 13

Re: Upload problem; uploading not working.

Posted 15 September 2013 - 05:46 AM

Ah, so that's the problem.

In that case, if I just change that, it should work?

And yes, I have ran it from a localhost.Are the server ones normally different from local ones?
Was This Post Helpful? 0
  • +
  • -

#10 andrewsw  Icon User is offline

  • Fire giant boob nipple gun!
  • member icon

Reputation: 3488
  • View blog
  • Posts: 11,902
  • Joined: 12-December 12

Re: Upload problem; uploading not working.

Posted 15 September 2013 - 05:50 AM

View Postchris98, on 15 September 2013 - 12:46 PM, said:

In that case, if I just change that, it should work?

And yes, I have ran it from a localhost.Are the server ones normally different from local ones?

1) Probably.
2) Yes, and it is often the case that the versions of PHP and MySQL that you installed locally will be different to those on your web-server.

If you do not have direct access to php.ini on the server (or by some other means from the control panel) then you may have to use ini_set() to change a setting temporarily.

This post has been edited by andrewsw: 15 September 2013 - 05:53 AM

Was This Post Helpful? 1
  • +
  • -

#11 chris98  Icon User is offline

  • D.I.C Addict

Reputation: 21
  • View blog
  • Posts: 802
  • Joined: 06-July 13

Re: Upload problem; uploading not working.

Posted 15 September 2013 - 06:00 AM

No, it still appears.Are the limits on the servers normally bigger?

(NOTE: The file I am trying to upload is 2.35 MB)

This post has been edited by chris98: 15 September 2013 - 06:02 AM

Was This Post Helpful? 0
  • +
  • -

#12 andrewsw  Icon User is offline

  • Fire giant boob nipple gun!
  • member icon

Reputation: 3488
  • View blog
  • Posts: 11,902
  • Joined: 12-December 12

Re: Upload problem; uploading not working.

Posted 15 September 2013 - 06:16 AM

Yes, I believe that, typically, values on the (live) server are bigger, but if you run your phpinfo() script from the server you will discover these values. Alternatively, these settings may be available somewhere from your host's control-panel.

BTW It is a good practice to also limit the file-size from the client-side:

<input type="hidden" id="max_file" name="MAX_FILE_SIZE" value="300000">

(in bytes)
but this value cannot be relied upon: you need to check the file-size on the server, with PHP.

This post has been edited by andrewsw: 15 September 2013 - 06:23 AM

Was This Post Helpful? 0
  • +
  • -

#13 chris98  Icon User is offline

  • D.I.C Addict

Reputation: 21
  • View blog
  • Posts: 802
  • Joined: 06-July 13

Re: Upload problem; uploading not working.

Posted 15 September 2013 - 06:24 AM

Would the hidden input do the same as changing the value, or would it be as well?



And this is from the server.It appears (I think) that the same problem will occur.How would I change the value on the server?


max_file_uploads

20

20

 

max_input_nesting_level

64

64

 

max_input_time

10

10

 

memory_limit

64M

64M

 

open_basedir

/home/:/usr/lib/php:/tmp

no value

 

output_buffering

1

1

 

output_handler

no value

no value

 

post_max_size

2M

2M

 

precision

12

12

 

realpath_cache_size

16K

16K

 

realpath_cache_ttl

120

120

 

register_argc_argv

Off

Off

 

register_globals

Off

Off

 

register_long_arrays

On

On

 

report_memleaks

On

On

 

report_zend_debug

On

On

 

safe_mode

Off

Off

 

safe_mode_exec_dir

no value

no value

 

safe_mode_gid

Off

Off

 

safe_mode_include_dir

no value

no value

 

sendmail_from

no value

no value

 

sendmail_path

/usr/local/bin/phpsendmail

/usr/local/bin/phpsendmail

 

serialize_precision

100

100

 

short_open_tag

On

On

 

SMTP

localhost

localhost

 

smtp_port

25

25

 

sql.safe_mode

Off

Off

 

track_errors

Off

Off

 

unserialize_callback_func

no value

no value

 

upload_max_filesize

2M

2M

 

upload_tmp_dir

/tmp


Was This Post Helpful? 0
  • +
  • -

#14 andrewsw  Icon User is offline

  • Fire giant boob nipple gun!
  • member icon

Reputation: 3488
  • View blog
  • Posts: 11,902
  • Joined: 12-December 12

Re: Upload problem; uploading not working.

Posted 15 September 2013 - 06:48 AM

Quote

Would the hidden input do the same as changing the value, or would it be as well?

It would be in addition to whatever happens on the server - just use the same size (or approx.) for both.

Quote

How would I change the value on the server?

Gosh, this has already been mentioned several times. But to summarize:

  • Modify the php.ini file on the (live) server, assuming you have access to this file (write permissions).
  • If you don't have direct access to the file, there may be a way to change settings via your host's control-panel.
  • If not, investigate the ini_set() function I linked to recently.

This post has been edited by andrewsw: 15 September 2013 - 06:54 AM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1