Jump to content

rar zip file uploading


iedoc

Recommended Posts

i promise i've searched through the internet for days now reading forums and stuff with no luck on fixing this. i even registered to this site just so i can ask this question. i usually don't have much of a problem finding the answers to these types of questions.

 

but anyway, i'm trying to upload zip or rar files. i don't care about security at the moment, i can do all that later, the admin will check each upload to make sure its safe and works, so viruses or unwanted uploads will not be available to the other users. the problem is i can upload images like jpg and gif and stuff, but when i try to upload a compressed file (zip or rar), the html form doesn't send ANY POST data. i have even changed the extension on the compressed files and nothing changes. i'll show my code so you can see whats up.

 

php code

 

print_r($_FILES);     (for testing)
if (isset($_POST['startuploading'])) {

if ($_POST['startuploading'] == 'yes') {

	$filename =$_FILES['file']["name"];

	if($_FILES["file"]["size"] < 50000000) {

		$ext = end(explode('.', $filename));
		echo $ext;      (these two lines 
		echo 'hello';                are for testing purposes)
		if ($ext = 'rar' || $ext = 'zip') {

				if ($_FILES["file"]["error"] > 0) {
					echo "Return Code: " . $_FILES["file"]["error"] . "<br />";
				}

				else {
   						echo "Upload: " . $_FILES["file"]["name"] . "<br />";
    					echo "Type: " . $_FILES["file"]["type"] . "<br />";
    					echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />";
    					echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br />";

    					if (file_exists("models/" . $_FILES["file"]["name"]))
      					{
      						echo $_FILES["file"]["name"] . " already exists. ";
      					}

    					else {
						move_uploaded_file($_FILES["file"]["tmp_name"], "models/" . $_FILES["file"]["name"]);
						echo "Stored in: " . "models/" . $_FILES["file"]["name"];
					}
    				}

		}
		else {
			echo "Invalid File Format";
  			}
	}
	else {
		echo "File size too large";
  		}
}
}

 

html form

 

<form action="upload.php" method="post" enctype="multipart/form-data">
<input style="color:#6F6" type="file" name="file" id="file" />
<input type="submit" value="Upload Model!" />
<input type="hidden" name="startuploading" value="yes" />
</form>

 

this is just the part of code dealing with file uploading

 

again, i'm sure the problem has to do with the html for actually, since not even the "startuploading" Post is sent, and the print_r($_FILES); statement shows only Array()

 

oh yeah, and thanks a TON for any help fixing this problem

 

Link to comment
Share on other sites

wow, sorry, i'm an idiot, i didn't realize it was because of the file size. now i just need to know how to change how big of a file people can upload. i can look on the internet, but if someone has an idea, that would be cool too. i read that these forums don't delete threads and stuff, so when i find the answer i'll post it here, although i know i've come across people asking about this before so it might just be a waste of space.

Link to comment
Share on other sites

now i just need to know how to change how big of a file people can upload

 

The settings that affect the maximum upload file size can be set in the master php.ini (when you have access to it), in a local php.ini (when php is running as an CGI application), or in a .htaccess file (when php is running as an Apache Module.)

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.