【问题标题】:How to to send huge data to server from cordova app如何从科尔多瓦应用程序向服务器发送大量数据
【发布时间】:2019-07-03 07:46:54
【问题描述】:

我正在使用 jquery serialize 将表单数据从 cordova 应用程序发送到 PHP 服务器,该表单是用户订单的动态购物车,它适用于 30-35 个项目,但是当用户尝试发送更多项目时,应用程序失败.

我们将 php.ini 中的 post_max_size = 8M 更改为 30M,但它也失败了。

这是表单的一部分...

<li class="checkoutrow" style="position: relative;">
<input type="hidden" name="idproduct[]" value="'+cart[i].idproduct+'" id="idproduct" class="idproduct">
<input type="hidden" name="cod_prod[]" value="'+cart[i].cod_prod+'" id="cod_prod" class="cod_prod">
<input type="hidden" name="subtotal[]" value="'+subtotalneto+'" >
<input type="hidden" name="subtotaliva[]" value="'+subtotaliva+'" >
<h3 class="product-name">
<textarea name="description[]" style="width: 90%; color: #ae0000;" rows="2" readonly>'+cart[i].description+'</textarea>
</h3>
<span class="cart-delete"><a onclick="delete_cart_item('+i+', this);" href="#"><i class="fa fa fa-times"></i></a></span>
<div class="table">
<div class="qty col" style="width: 20%;"><input style="width: 98%; border: none;" type="number" name="qty[]" value="'+cart[i].qty+'" readonly ></div>
<div class="price col" style="width: 27%;"><input style="width: 98%; border: none;"  type="text" name="price[]" value="'+cart[i].price+'" readonly></div>
<div class="col" style="width: 23%;"><input type="text" style="width: 98%; border: none; text-align: center;" name="descuento[]" value="'+cart[i].descuento+'" readonly></div>
<div class="subtotalitem col" style="width: 30%;"><input style="width: 98%; border: none; text-align: right;" type="text" name="subtotalitem[]" value="'+subtotalitem+'" readonly></div>
</div></li>

【问题讨论】:

  • 您尝试过 max_execution_time 吗? stackoverflow.com/questions/3829403/…
  • 不,我会试试的,谢谢你的建议
  • 我不知道 Cordova 在发送任何大小的数据方面有任何限制 - 您可以发送比任何购物车大得多的图像、视频文件,因此(在我看来)您的上传获得了卡在别的地方了。
  • 我从 30 秒改为 60 秒(太多),它也失败了。
  • 在同一个应用程序中,我们使用现代相机(大文件)非常快速地发送图像。我们发送 30 - 35 件物品的速度非常快,但是当用户尝试发送 40 件物品时,应用程序失败了。

标签: javascript jquery rest api cordova


【解决方案1】:

最后,它仅在我发送 30 到 40 件商品时才有效。我解决了对数据进行分页的问题。当检测到最后一个包裹时,我会更改订单状态并将其作为已发送。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-11-18
    • 1970-01-01
    • 2019-01-13
    • 2017-06-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多