Overcome the maximum host file size limit for PHP / POST data when uploading files?

At the moment, I have a rather mediocre inexpensive (shared) host (like everything I can afford now), and I want to implement a very basic file upload function on a page. I want to allow uploading files up to 100 MB to the server, but my free host limits PHP_MAX_FILESIZE to 32 MB and POST_FILESIZE to 64 MB.

Is there a way to overcome this without requiring the user to break large files into smaller pieces? Or a JavaScript or Flash-based solution that can somehow redirect parts of a file through various HTTP requests, or bypass the 32 MB limit in some other way?

Or are there any commands that I can try to make that can exceed host restrictions? I have already tried using .htaccess without success. EDIT: also tried ini_set. I think the only way is something like chunking / splitting / multi-streaming or another way to solve the problem of being unable to set higher PHP values.

Any suggestions are greatly appreciated. Thank.

+3
source share
8 answers

may also be able to use ini_set('upload_max_filesize','100M');

, , ...

+1

java-, sourceforge . dw java- . , , , , .

, http://sourceforge.net/projects/juploader/

+1

php.ini(, ), . , 100MB , , .

0

ini_set, , , .htaccess. , - php_flag. , .

. , , , .

- . , , - . , , FTP. .

0

. URL- . , , , . , , , , , ( , , ).

0

:

1) (catch onsubmit); textarea.

2) .

:

, script , :

 XMLHttpRequest

( , URL- )

 FileSystemObject

( Windows Scripting Host Internet Explorer ) "" Java-, URL- script.

( http://www.javascripter.net/faq/reading2.htm)

, .

.

mySplitResult = myReadedDocument.split( 1024 * 1024 ); // 1M each

:

(, []. , id "myForm":

formName = document.getElementById('myForm');

mySplitResult.forEach(function(item) {     
    ta = document.createElement('textarea');
    ta.appendChild(document.createTextNode(item))
    ta.setAttribute("name", "chunk[]" );
    formName.appendChild(ta);

});

.

<?php
    $chunks = $_POST['chunk'];
    $fileContent = implode( '', $chunks );
    file_put_content( 'dirname/filename.foo', $fileContent );
?>

, .

!

0

Source: https://habr.com/ru/post/1789563/


All Articles