LPology / Simple-Ajax-Uploader

Javascript file upload plugin with progress bar support. Works in all major browsers, including IE7+, Chrome, Firefox, Safari, and Opera. No dependencies - use it with or without jQuery.
995 stars 267 forks source link

Error UploadFile .mp4 size > 10M #78

Closed Bankaphiwit closed 9 years ago

Bankaphiwit commented 9 years ago

Fatal error: Uncaught exception 'Exception' with message 'Content length not supported.' in C:\AppServ\www\path\uploadfile\Uploader.php:36 Stack trace: #0 C:\AppServ\www\path\uploadfile\Uploader.php(92): FileUploadXHR->getFileSize() #1 C:\AppServ\www\path\uploadfile\upload_temp.php(48): FileUpload->__construct('upload_progress...') #2 {main} thrown in C:\AppServ\www\path\uploadfile\Uploader.php on line 36

AND I edit code in File Uploader.plhp line 70 : public $sizeLimit = 1110485760; // Max file upload size in bytes (default 10MB)

But I can upload width normal form success ext :

        <input type="submit" />
    </form>
LPology commented 9 years ago

Can you post your code?

Bankaphiwit commented 9 years ago

you can view demo and download code in link : http://schoobag.com/testupload/

if you upload .mp4 size > 45M code error

LPology commented 9 years ago

Do you know what the settings in your php.ini are for upload_max_size and post_max_size?

The default limit is something less than 10M, and an error will occur if an upload is attempted that exceeds the size limit.

Here's a Stack Overflow question about it:

http://stackoverflow.com/questions/2184513/php-change-the-maximum-upload-file-size/2184541

Let me know what you find.

LPology commented 9 years ago

Btw, don't forget to restart your Apache server after making changes, if you end up changing anything.

Bankaphiwit commented 9 years ago

yes, I change phpinfo
memory_limit: 128M post_max_size : 500M upload_max_filesize : 500M

but code same is error

you view phpinfo me to link : http://schoobag.com/schoobag/000.php

i can upload file .mp4 > 45M form normal code ext: "

"

LPology commented 9 years ago

To be honest, I'm not sure what's causing the issue. I have two ideas:

  1. Try setting the multipart option to true in your Javascript settings.
  2. Check your error log after trying to upload a file and then let me know if there are any errors occurring.
Bankaphiwit commented 9 years ago

I'm trying setting { button: btn, url: 'upload_temp.php', progressUrl: 'uploadProgress.php', name: 'upload_progress_ba', multiple: true, maxUploads: 10, method: 'POST', allowedExtensions: ['mp4'], accept: 'video/*', responseType: 'json', data: {'data_numfile': 1}, }

Error when upload file > 45M, Error log in console : Line 1 :POST path/upload_temp.php?upload_progress_ba=test.mp4&data_numfile=1 SimpleAjaxUploader.js:1197

Line 2 :m.SimpleUpload._uploadXhr SimpleAjaxUploader.js:1197

Line 3 :m.SimpleUpload.submit SimpleAjaxUploader.js:1641

Line 4 :(anonymous function) SimpleAjaxUploader.js:846

SimpleAjaxUploader.js:1197 : 1194-1198 else { xhr.setRequestHeader( 'Content-Type', 'application/octet-stream' ); this.log( 'Commencing upload using binary stream' ); xhr.send( this._file ); }

SimpleAjaxUploader.js:1641: this._uploadXhr( filename, size, this._sizeBox, this._progBar, this._progBox, this._pctBox, this._abortBtn, this._removeAbort, this._queue[0].btn /* upload button */ );

SimpleAjaxUploader.js:846: 845-847 if ( self._opts.autoSubmit ) { self.submit(); }

when I click link error code Line 1 : text in page Fatal error: Uncaught exception 'Exception' with message 'Content length not supported.' in path\Uploader.php:36 Stack trace: #0 path\Uploader.php(92): FileUploadXHR->getFileSize() #1 path\upload_temp.php(43): FileUpload->__construct('upload_progress...') #2 {main} thrown in path\Uploader.php on line 36

code Error Uploader.php(36):32-38 public function getFileSize() { if (isset($_SERVER['CONTENT_LENGTH'])) { return (int)$_SERVER['CONTENT_LENGTH']; } else { throw new Exception('Content length not supported.'); } }

Uploader.php(92):89-97 if ($this->handler) { $this->handler->uploadName = $uploadName; $this->fileName = $this->handler->getFileName(); $this->fileSize = $this->handler->getFileSize(); $fileInfo = pathinfo($this->fileName); if (array_key_exists('extension', $fileInfo)) { $this->fileExtension = strtolower($fileInfo['extension']); } }

upload_temp.php(43): $Upload = new FileUpload('upload_progress_ba');

Bankaphiwit commented 9 years ago

OK, I'm can upload complete because I'm trying setting multipart option to true. Thunk you very very very must :) :+1:

LPology commented 9 years ago

Glad I could help.