Skip to content Skip to sidebar Skip to footer

What Is The Alternative Of Passing Array To The URL?(URL Too Long)

WHile requesting from GET method, The url is created like ?paths=path1&paths=path2&paths=path3... This can be very long if there are large number of paths

Solution 1:

You could use a form instead of a hyperlink to submit a POST request and send your paths in POST data. See below for example code

<form method="POST" action="{% url 'test_download' %}">
    {% csrf_token %}
    {% for path in paths %}
        <input type="hidden" name="paths" value="{{ path }}"
    {% endfor %}
    <button type="submit">Converted Files</button>
</form>

Post a Comment for "What Is The Alternative Of Passing Array To The URL?(URL Too Long)"