问题在上传文件IE6大于10MB [英] Problem uploading files greater than 10Mb in IE6

查看:135
本文介绍了问题在上传文件IE6大于10MB的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

哎。这code工作在大多数浏览器,甚至部分在IE6。它上传文件的10Mb以下(约),但不是什么大。在code指定这些文件是允许的。

另外请注意,好像整个文件似乎被转移到前忽略的服务器。

该网站是: www.mgxvideo.com/mgxcopy-alpha-3/,并可以通过在车增加一个项目,然后点击上传功能即可到达。想法?

下面的形式:

 <表单的enctype =的multipart / form-data的行动=?upload_files.php ORDER_ID =< PHP的echo $ _GET ['的order_id']>?方法=POST>
    <表样式=宽度:100%>
        &所述; TR>
        < TD VALIGN =顶>
        <跨度类=STYLE1>选择要上传的文件:LT; / SPAN>
        < / TD>
        < TD VALIGN =顶>
        <输入名称=UploadedFile的TYPE =文件/>
        < / TD>
        < / TR>
    < /表>
    <输入类型=提交值=上传文件/>
    <输入类型=隐藏名称=行动值=添加/>
    <输入类型=隐藏的名字=MAX_FILE_SIZEVALUE =亿/>
< /表及GT;

下面是在upload_files.php的顶部一行:

  $ upload_output = upload_file($ CUSTOMER_ID,$ _REQUEST ['行动'],$ _GET ['ORDER_ID'],$ _ FILES);

这里是upload_file()code:

 函数upload_file($ CUSTOMER_ID,$行动,$ upload_id,$ FILES)
{
$ target_path =上传/;$ target_path = $ target_path。 $ CUSTOMER_ID。 _。 $ upload_id。 _。基本名($ FILES ['UploadedFile的'] ['名']);
$ str_output ='';如果($行动=='德尔'和file_exists($ _ POST ['文件路径']))
{
DELETE_FILE($ CUSTOMER_ID,$ _ POST ['文件路径']);
$ str_output ='<跨度类=STYLE1>文件删除成功。如果完成上传文件,。
'< A HREF =#的onclick =self.close();>点击此处< / A>关闭此窗口< / SPAN>';
的setcookie(upload_out_txt,$ str_output,时间()+ 300);
的setcookie(upload_out_b,1,时间()+ 300);
}否则如果($行动=='加')
{
如果(count_uploads($ CUSTOMER_ID,$ upload_id)GT = 2)
{
$ str_output ='<跨度类=STYLE1>问题:您已达到最大允许上传这个特定的顺序。 。继续&LT之前,请删除文件; / SPAN>';
的setcookie(upload_out_txt,$ str_output,时间()+ 300);
的setcookie(upload_out_b,1,时间()+ 300);
}否则如果(file_exists($ target_path))
{
$ str_output ='<跨度类=STYLE1>问题:您尝试已上传的文件存在的一个版本。再次上传&LT之前,请删除了服务器上的文件; / SPAN>';
的setcookie(upload_out_txt,$ str_output,时间()+ 300);
的setcookie(upload_out_b,1,时间()+ 300);
}否则如果(move_uploaded_file($ FILES ['UploadedFile的'] ['tmp_name的值'],$ target_path))
{
insert_to_database('uploaded_files',阵列($ CUSTOMER_ID,$ upload_id,'NOW()',$ target_path));
$ str_output ='<跨度类=STYLE1>成功。该文件已成功上传。如果你都做了,< A HREF =的onclick =window.close()的;>点击此处关闭窗口< / A>< / SPAN>';
的setcookie(upload_out_txt,$ str_output,时间()+ 300);
的setcookie(upload_out_b,1,时间()+ 300);
}其他
{
$ str_output ='<跨度类=STYLE1>有一个错误上传文件,请重试<!/ SPAN>';
的setcookie(upload_out_txt,$ str_output,时间()+ 300);
的setcookie(upload_out_b,1,时间()+ 300);
}
}返回$ str_output;
}

下面是我的php.ini文件后,我试图执行一个修复:

 的extension_dir =/ kunden /主页/ 30 / d93769495 / htdocs中/扩展;
延长= uploadprogress.so;
的upload_max_filesize = 150M;
的post_max_size = 210M;
max_input_time设置= 1800;
file_uploads = 1;
memory_limit的= 240M;
的max_execution_time = 1800;


检查的php.ini 以下设置:


  1. 的upload_max_filesize 必须大于10 MIB( 10M


  2. 的post_max_size 需要比的upload_max_filesize 至少大40%


      

    为什么这是必需的原因是,一些老用户代理将上传使用base64编码,增加了37%的开销来的数据。添加MIME头,其他参数后,有充足的理由把它比的upload_max_filesize



  3. max_input_time设置 需要至少为900(15分钟)。


      

    您想给足够的时间让用户上传其文件。



Hey. This code works in most browsers, and even partially in IE6. It uploads files less 10Mb (approximately), but not anything larger. The code specifies that those files are permitted.

Also, note that it seems like the entire file seems to be transferred to the servers before disregarded.

The website is at: www.mgxvideo.com/mgxcopy-alpha-3/ and can be reached by adding an item in the cart, and then clicking the upload function. Ideas?

Here is the form:

<form enctype="multipart/form-data" action="upload_files.php?order_id=<?php echo $_GET['order_id'] ?>" method="POST">
    <table style="width:100%">
        <tr>
        	<td valign="top">
        		<span class="style1">Choose a file to upload: </span> 
        	</td>
        	<td valign="top">
        		<input name="uploadedfile" type="file" />
        	</td>
        </tr>
    </table>
    <input type="submit" value="Upload File" />
    <input type="hidden" name="action" value="add"/>
    <input type="hidden" name="MAX_FILE_SIZE" value="100000000" />
</form>

Here is a line at the top of upload_files.php:

$upload_output = upload_file($customer_id, $_REQUEST['action'], $_GET['order_id'], $_FILES);

And here is the upload_file() code:

function upload_file($customer_id, $action, $upload_id, $FILES)
{
	$target_path = "uploads/";

	$target_path = $target_path . $customer_id . '_' . $upload_id . '_' . basename( $FILES['uploadedfile']['name']); 
	$str_output = '';

	if ($action == 'del' and file_exists($_POST['filepath']))
	{
		delete_file($customer_id, $_POST['filepath']);
		$str_output = '<span class="style1">File successfully deleted. If you are done uploading files, ' .
				'<a href="#" onclick="self.close();">click here</a> to close this window.</span>';
		setcookie("upload_out_txt", $str_output, time() + 300);
		setcookie("upload_out_b", "1", time() + 300);
	} else if ($action == 'add')
	{
		if (count_uploads($customer_id, $upload_id) >= 2)
		{
			$str_output = '<span class="style1">Problem: You have reached the maximum allowed uploads for this particular order. Please delete a file before continuing.</span>';
			setcookie("upload_out_txt", $str_output, time() + 300);
			setcookie("upload_out_b", "1", time() + 300);
		} else if (file_exists($target_path))
		{
			$str_output = '<span class="style1">Problem: A version of the file you are trying to upload already exists. Please delete the file from out servers before uploading again.</span>';
			setcookie("upload_out_txt", $str_output, time() + 300);
			setcookie("upload_out_b", "1", time() + 300);
		} else if (move_uploaded_file($FILES['uploadedfile']['tmp_name'], $target_path)) 
		{
			insert_to_database('uploaded_files', array($customer_id, $upload_id, 'now()', $target_path));
			$str_output = '<span class="style1">Success. The file was successfully uploaded. If you are done, <a href="" onclick="window.close();">click here to close the window</a></span>';
			setcookie("upload_out_txt", $str_output, time() + 300);
			setcookie("upload_out_b", "1", time() + 300);
		} else
		{
			$str_output = '<span class="style1">There was an error uploading the file, please try again!</span>';
			setcookie("upload_out_txt", $str_output, time() + 300);
			setcookie("upload_out_b", "1", time() + 300);
		}
	}



	return $str_output;
}

Here is my php.ini file, after I tried to implement a fix:

extension_dir="/kunden/homepages/30/d93769495/htdocs/extensions";
extension=uploadprogress.so;
upload_max_filesize=150M;
post_max_size=210M;
max_input_time=1800;
file_uploads=1;
memory_limit=240M;
max_execution_time=1800;

解决方案

Check the following settings in php.ini:

  1. upload_max_filesize needs to be greater than 10 MiB (10M).

  2. post_max_size needs to be at least 40% greater than upload_max_filesize.

    The reason why this is required is that some old user-agents will upload using base64 encoding, which adds a 37% overhead to the data. Add mime headers, other post parameters, there are plenty of reasons to have it higher than upload_max_filesize.

  3. max_input_time needs to be at least 900 (15 minutes).

    You want to give enough time for the user to upload its file.

这篇关于问题在上传文件IE6大于10MB的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆