Jump to content

file upload doesn't exist sometimes


dadamssg87

Recommended Posts

I'm trying to do a simple image upload. It works fine on my local server but i'm moving all my files to my production server and some files i attempt to upload, via an html form, don't register. The $_FILES variable doesn't exist sometimes. I think its because of the file size but i'm not sure.

 

The form has two inputs: "title" and "userfile". I can put something in the title and attempt to upload a small excel file and both $_POST and $_FILES exist but if i do a larger image file both $_POST and $_FILES don't even get set.

 

I did an "echo ini_get('post_max_size');" and i get "8M". The image i'm attempting to upload is only 0.34M so i should be good there.

 

I've replaced the actual upload script with this, which is how i found out the variables only get set sometimes

 

 

Any suggestions would be much appreciated.

<?php
  echo "Upload: " . $_FILES["userfile"]["name"] . "<br />";
  echo "Type: " . $_FILES["userfile"]["type"] . "<br />";
  echo "Size: " . ($_FILES["userfile"]["size"] / 1024) . " Kb<br />";
  echo "Stored in: " . $_FILES["userfile"]["tmp_name"];

	echo "<hr><pre>";
	print_r($_POST);
	echo "</pre><hr>";

	echo "<pre>";
	print_r($_FILES);
	echo "</pre>";

 

 

Link to comment
Share on other sites

What does adding the following three lines of code, immediately after the <?php tag show -

 

ini_set("display_startup_errors", "1");
ini_set("display_errors", "1");
error_reporting(-1);

 

What does the phpinfo(); output show for both the master and local 'post_max_size'?

 

Any chance your server has the Suhosin hardened php patch installed as it can mess with the external data that can be submitted?

 

Edit: also what php version and what does the phpinfo() output show for register_globals?

Link to comment
Share on other sites

Is your upload form a simple html form or is it doing something with javascript/ajax/flash that could potentially make the form invalid or prevent the submission of any actual data under certain circumstances?

 

I would contact your web host to see if they have imposed some upload size policy that is outside of what the php settings can affect.

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.