MediaManager bug fix leads to enhancements

The application at

https://www.uvm.edu/htpasswd/podcast_manager

was exhibiting strange behavior. Guy from COM had 607 Mb file, wouldn’t upload.

Fixed and improved, can now upload up to 10Gb files (when used with a ‘modern’ browser).
Some background …

It’s just a glorified file uploader, relying on plupload (1.5.8).  There is evidence (/users/c/o/comvideo/public_html/podcast_folder) that as of last October, it was working fine. Now, For a certain file size 343Mb < N < 607MB, upload succeeds in Safari and FireFox on MacOS; fails on Chrome Mac and Win, FireFox Win, and IE. It is setup to use HTML5 runtime, no chunking for all but IE. For IE, Silverlight and chunking.

Chunking? Yes. Upload widget sends file in (now set to) 10Mb 'chunks.' Each chunk is sent to the same php script, along with file name, chunk number, and total chunks. php script appends chunk  to file. This gets us around  the (UVM/ETS/SAA) imposed php max file size limit of 1Gb.

Step forward

I blamed it all on upgraded browsers and old plupload. So I created

https://www.uvm.edu/htpasswd/podcast_manager_dev

with plupload 2.1.1 and chunking all the time. And here is what I discovered:

The podcast_manager lives in /shares/uvmweb/htdocs/htpasswd/ , which has SAFE_MODE turned off, and relies on WebAuth set_uid magic to allow the script to create files in the REMOTE_USER’s home directory

plupload sends the first chunk 0, upload.php  creates filename_part with mode ‘wb’

$out = fopen(“{$filePath}.part”, $chunk == 0 ? “wb” : “ab”);

creates file and writes data to file. plupload sends next chunk 1, upload.php attempts to open file using mode ‘ab’, FAILS with a permission denied error, system crashes and burns. In fact, even trying to create a new file using mode ‘ab’ fails

 

On Mar 28, 2014, at 10:27 AM, Benjamin Coddington wrote:

I just (this morning) fixed a problem where un-authenticated PHP could not open files with O_APPEND.  That shouldn’t have changed the behavior for this case because you are using the WebAuth authentication.

Well, it shouldn’t, but now it does work

About Wesley Wright

Born on a mountain top near New York City, Craziest state in the land of the pretty. Raised in the woods so's he knew every tree, Killed him a bear when he was only three.
This entry was posted in Wes and tagged , . Bookmark the permalink.