Hello all,
I am trying to upload files via a very basic HTML form. It will upload files with ease that are small; I've tested picture files up to 1MB and movie files up to 4MB, however, when I have a larger file the page uploads halfway, hangs for a bit, and then gives me a "The Page Could Not Be Displayed" error. The largest file I have tried is 8.5MB.
Here is my .htaccess code:
>php_value upload_max_filesize 16M
php_value post_max_size 16M
php_value memory_limit 24M
php_value max_input_time 2400
php_value max_execution_time 2400
Here is my uploader.php code:
The directory is CHMOD 777...
><?
// Where the file is going to be placed
$target_path = "upload/";
/* Add the original filename to our target path. Result is "uploads/filename.extension" */
$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);
// This is how we will get the temporary file...
$_FILES['uploadedfile']['tmp_name'];
$target_path = "upload/";
$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);
if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded";
} else{
echo "There was an error uploading the file, please try again!";
}
?>
Here is my uploader.html code:
><html>
<body>
<form enctype="multipart/form-data" action="uploader.php" method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="16384000" />
Choose a file to upload: <input name="uploadedfile" type="file" /><br />
<input type="submit" value="Upload File" />
</form>
</body>
</html>
This is one of the most basic, stripped down uploading scripts out there. I was originally using the ImpAKT File Upload class (paid for script), however, that did not upload larger files either. So I decided to close out that variable by opting for basic code. Both codes have the same issue of uploading halfway and I have tested from three different computers with five different file types (.wmv, .mpg, .mov, .jpg, .gif), however, the code works perfectly on other servers.
I do not see any specific errors in my log files. I have already submitted many support tickets; one asking if this error is relating to settings in the httpd.conf file, most notably LimitRequestBody. I asked what setting it was and I was told very rudely that all I needed to do was put "php_value upload_max_filesize 16M" in my .htaccess file for it to work. If I "did not understand", I was to come here, to the scripting forums, and ask for support since this deals with scripting. However, if I cannot modify the httpd.conf file then it deals with the server, not scripting.
I'm also not able to access phpinfo() for "security reasons". Whatever they may be, this security is not allowing me to see if the "php_value" settings in my .htaccess file have passed correctly. I have asked to allow phpinfo(), however, I was denied. I am beginning to think some values for .htaccess are not being followed and everything is being defaulted.
I have already checked the following URLs and posts for information:
Php.ini Override Questions
Uploading Larges Files w/ PHP
Upload_max_filesize .htaccess
Wikipedia Uploading Files - Meta
All of Google
--- It Gets Better ---
I have two domains hosted with TCH and this script has been tested on two different servers with the same settings and files:
Server 103: Success
Server 107: Fail
So it is clearly evident that it is not my code or settings for the issue and is in fact a server-side error that I was trying to have checked earlier. So please, someone tell me it is my code that is the issue once again or my settings in .htaccess.
I am becoming very agitated with TCH. My first site has never had any problems, however, the second site was not setup correctly first try, twice the server went down (the second time resulted in a week's worth of work lost from the database) and now this issue, all within six months. This is not what I expected from many positive reviews of TCH being professional.
I am not going to submit another support ticket. I am tired of the rude responses and I would hate to see what someone just beginning to get their own site would go through asking simple questions. If all responses are to go visit the forums, then TCH should not have a ticket-support area at all.
Both sites are using the "Starter Plan" model. I would hate to think support is based on how much I pay, if so, something needs to change. I am planning on upgrading to the dedicated server options, however, if I cannot get a simple thing like this checked from support, then I am not going to even bother. I value a company based on how it treats me and other customers, no matter how much I pay, and TCH is severely lacking.
So how do I fix this issue? Submit another ticket? Go to the forums? Tell me, please.
- Jason Stauffer