Change Default Download Location in Php

134
January 18, 2022, at 09:20 AM

I want to change default download location in php Using header function I cant' find a parameter for that This is the definition of header

header(string $header, bool $replace = true, int $response_code = 0)

Is there any solution for header or other alternative to just change default download location Thanks

Answer 1

URL of solution Save current page as HTML to server

<?php
// Start the buffering //
ob_start();
?>

Your page content

<?php
echo '1';
file_put_contents('yourpage.html', ob_get_contents());
?>

Instead of yourpage.html you specifiy the path and it works

Rent Charter Buses Company
READ ALSO
Base 62 conversion

Base 62 conversion

How would you convert an integer to base 62 (like hexadecimal, but with these digits: '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ')

173
Store/Update large file efficiently

Store/Update large file efficiently

I am working on a grocery app which needs to keep updating the most recent available quantitiesTo do so, I need to keep overwriting and accessing a large object of quantities which is sent via api every min

100
Displaying the data from db in a table, one row/object at a time with Ajax python django

Displaying the data from db in a table, one row/object at a time with Ajax python django

I am working on a Django project where I display a list of dataWhen the list is too long the page takes longer to load due to the amount of data that are displayed in that list

99
Put a link on an Image Sprite

Put a link on an Image Sprite

I'm having a difficulty linking image spritesI want them to lead to particular websites but when I click the image sprite, it doesn't work at all

45