0

I have developed a program in flex 4.5 which creates byte data (the byte data is consumed by a larger, separate program and not part of this issue). In order to capture the byte data and write to actual .bda files, I am using flash.net.URLLoader to POST the bytedata through a flash.net.URLRequest to a .php file that captures the data and writes it to the server.

This process has worked like a charm until recently (possibly as a result of a PHP upgrade on the server or configuration change). Only the two largest files (about 1 MB a piece) are NOT being written to the server and I believe that the .php file is not being called for these two files at all.

What could be causing this discontinued function... any ideas?

The AS3 code in Flex 4.5:

        var byteArrayOut:URLRequest = new URLRequest('byteDataCatcher.php?filename=' + filename + '.bda');
        byteArrayOut.data = dataByteArray;
        byteArrayOut.method = URLRequestMethod.POST;

        var byteArrayOutLoader:URLLoader = new URLLoader();
        byteArrayOutLoader.dataFormat = URLLoaderDataFormat.BINARY;
        byteArrayOutLoader.load(byteArrayOut);
        byteArrayOutLoader.addEventListener(IOErrorEvent.IO_ERROR, failedToWriteBDAFile);

The PHP code ('byteDataCatcher.php'):

$data = file_get_contents("php://input");

$filename = $_GET['filename'];//"byteData.bda";

file_put_contents($filename, $data);
m59
  • 43,214
  • 14
  • 119
  • 136
user3103373
  • 101
  • 1
  • 2
    What is your memory limit set to in your php.ini file? Also what is your timeout limit set to? Usually the default is 30 seconds. – user602525 Dec 15 '13 at 03:54
  • 1
    If this problem was occurred after upgrade, you should chech **php.ini** file, size file upload restriction and script timeout too. – Ignacio Ocampo Dec 15 '13 at 03:57
  • I have made sure to provide adequate timeout and memory limit in the php.ini... this is set to: post_max_size = 100M memory_limit = 128M .... upload_max_filesize = 100M default_socket_timeout = 6000 Thanks! – user3103373 Dec 15 '13 at 04:18
  • I have tested the php.ini settings above and no improvements in performance happened. Could there be other settings in PHP that keep byteDataCatcher.php from getting the bytearray data from flash? Like I said, it is only the largest files of about 1mb that get lost between flash and .php. – user3103373 Dec 15 '13 at 17:28
  • For any one interested... The solution wound up being an alteration to ModSecurity on the server. ModSecurity was killing the process in capturing the largest files (of about 1MB). The server admin performed the task so that is the extent of detail I can offer. From what I have gathered php.ini configuration would be the more usual suspect in a case like this. – user3103373 Dec 19 '13 at 03:19

0 Answers0