简体   繁体   English

通过HTML表单上传.gz文件

[英]Uploading a .gz file VIA html form

I've been searching google abit and could not find anything that would help! 我一直在搜索google abit,找不到任何有帮助的东西! I have a customer that would like to upload large CSV files of products (A right pain as there 150mb plus uncompressed). 我有一个客户想要上传产品的大型CSV文件(很痛苦,因为那里有150mb加上未压缩的内容)。

I Noticed that he gets the files compressed from the wholesaler with gz (down to 6mb). 我注意到他从批发商那里以gz(压缩到6mb)压缩了文件。 I've been trying to upload the gz via the admin form I've created for him but the $_FILES global is empty when submitting (this is after it has gone through the upload to the tmpdir) 我一直在尝试通过为他创建的管理表单上传gz,但是提交时$ _FILES全局为空(这是通过上传到tmpdir之后的结果)

everything works fine if i upload the uncompressed csv (as in the $_FILES global is not empty), So i'm guessing the server is blocking the file? 如果我上传未压缩的csv,一切都可以正常工作(因为$ _FILES全局不为空),所以我猜服务器正在阻止文件? but i can't find anything about this and checking out other upload scripts people are allowing the extension. 但我对此一无所获,并查看其他人允许扩展的上传脚本。

Form Below: 表格如下:

<form action="/admin.php?current_page=new_upload" method="post" enctype="multipart/form-data">

<label for="csvFile">CSV File: (*)</label>
<input class="form-control" type="file" required name="csvFile" id="csvFile" />        
<input class="btn btn-success" id="subBtn" type="submit" value="Upload CSV to Site" />
</form>

Getting tmp_name here which is empty when trying to upload gz file (first line on the file): 尝试上传gz文件(文件的第一行)时,在此处获取tmp_name时为空:

$fn = $_FILES['csvFile']['tmp_name'];

put a var_dump($_FILES) at the top of the file and its completely empty, so its getting lost before hitting any of the script 将var_dump($ _ FILES)放在文件顶部,并且完全为空,因此在命中任何脚本之前都会迷路

But no issues if I upload a .csv file 但是如果我上传.csv文件没有问题

So i finally gave in and uploaded the huge uncompressed file, which failed, i then GZ'd the sample data and it worked fine, so it must be an issue with file size, and even though the gz is only 6mb (we've set the limit to 150mb) the server must be reading the file at its actual size before even touching the script. 因此,我终于放弃并上传了巨大的未压缩文件,但失败了,然后我将示例数据进行了GZ处理,并且工作正常,因此这一定是文件大小的问题,即使gz只有6mb(我们已经将限制设置为150mb),服务器甚至必须在触摸脚本之前以实际大小读取文件。

I'll be playing around with the server settings, but thanks for looking anyway! 我将使用服务器设置,但还是感谢您的配合!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM