Jump to content

Can't upload files over 1MB


Recommended Posts

My site is hosted by 1and1.com though a business package, so I don't own the server, or have it locally.

 

I'm using the following simple php upload code which will be used for uploading rather long sound files (30-60mb) to my server:

 

upload.php

<form enctype="multipart/form-data" id="sermonadd" action="submit.php" method="post">
<input name="uploaded" type="file">
<input type="submit">
</form>

 

submit.php

<? php
$target = "sermons/"; 
$target = $target . basename( $_FILES['uploaded']['name']) ; 
$ok=1; 
if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target)) 
{
echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded";
} 
else {
echo "Sorry, there was a problem uploading your file.";
}
?>

 

That's not the problem - Actually it works just fine... for files under 1MB. As the file size hits 1MB I get "Sorry, there was a problem uploading your file." and it's no where to be found on the server.

 

I tried the code on another server, and it worked there just fine- over or under 1MB

 

I also tried using other php upload codes, including one that works via ftp - still the same issue (although with that one, it just creates a file with the right name on the server that is 0k if it's over 1MB...again if it's under, it uploads just fine).

 

I know I can upload files to the server via ftp over 1MB - I've done it through filezilla many times.

 

After all this, I figured the only explanation is that it's a server-side php error. Obviously there's no ftp limit, it works fine on my other server, I tried it in several browsers, on several different computers and with several different upload codes- all which yielded no improvement.

 

My host allows local changes to the php.ini file by placing a file including the overrides in the affected directory as php.ini

 

suspecting it could be the upload_max_filesize or the post_max_size, I changed both of those to 100MB and also changed the memory_limit to -1 just in case.

 

I verified these changes were working with phpinfo() , but unfortunately the problem is still there- I still cannot upload any files over 1MB.

 

Trying to contact the host has been a nightmare- both over the phone and email. They haven't a clue what I'm talking about and insist it must be a coding error.

 

Does anyone have any clue whats causing this 1MB limit? I've tried EVERYTHING I can possibly think to do and I'm at a standstill.

 

I tried to be thorough, but if you need any more information- just ask.

 

Thanks in advance!

Link to comment
Share on other sites

Show us the actual lines you put into the local php.ini

 

For debugging purposes, what does adding the following code to your form processing code show -

 

ini_set("display_startup_errors", "1");
ini_set("display_errors", "1");
error_reporting(E_ALL);
echo "<pre>";
echo "FILES:";
print_r($_FILES);
echo "</pre>";

 

Edit: Also, is your .php script in the same folder where you put the php.ini? According to one of the 1and1 FAQ, you must put a php.ini into each folder where you put a .php script in order to affect that php script.

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.