I solved my problem on PUT Method Upload...

If you believe or not the old HTTP PUT method is 60% faster as the conventional method!



You send Only file upload ++ autenficate chunk on cookie.... PUT header

http://www.qtforum.de/forum/viewtopic.php?t=3085

on php site i use PoPoon http://wiki.flux-cms.org/display/FLX/Popoon

if you dont have access on server..... mist...

Qt Code:
  1. <?php
  2. /* davimage.php */
  3.  
  4. include_once("popoon/components/action.php");
  5. /**
  6. * http://bx.ppk.go/page/movie/page/movie/upimzip/bio/13462346/
  7. * http://bx.ppk.go/page/movie/page/movie/upimzip/film/13462346/
  8. */
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18. class popoon_components_actions_davcmszip extends popoon_components_action {
  19.  
  20. /**
  21.   * Constructor
  22.   *
  23.   */
  24.  
  25.  
  26.  
  27.  
  28.  
  29. function Reset_Dir($dir) {
  30. $dirfos = $dir;
  31. if (is_dir($dirfos)) {
  32. $d = dir($dirfos);
  33. $mone=0;
  34. while (false !== ($entry = $d->read())) {
  35. if ($entry == "." or $entry =="..") {
  36. continue;
  37. }
  38. if (is_dir($dirfos.$entry)) { /// is_dir bug???
  39. continue;
  40. }
  41. if (is_file($dirfos.$entry)) {
  42. @unlink($dirfos.$entry);
  43. $mone++;
  44. }
  45. }
  46.  
  47. }
  48. }
  49.  
  50.  
  51. function Make_Dir($dir) {
  52. if (eregi('data', $dir)) {
  53. @shell_exec(escapeshellcmd('mkdir -p '.$dir)); ///PHP FastCGI from owner or www-data ///
  54. if (!is_dir($dir)) {
  55. print("<h1>ERROR Permission Denied! (Make_Dir ".$dir.")</h1> <p>".__FILE__."#".__LINE__."<p>");
  56. exit;
  57. } else {
  58. return true;
  59. }
  60. } else {
  61. print("<h1>ERROR Permission Denied! (Make_Dir ".$dir.")</h1> <p>".__FILE__."#".__LINE__."<p>");
  62. return false;
  63. }
  64.  
  65. return false;
  66. }
  67.  
  68. function ResetCache() {
  69. $dirfos = CACHEWEBS;
  70. if (is_dir($dirfos)) {
  71. $d = dir($dirfos);
  72. $mone=0;
  73. while (false !== ($entry = $d->read())) {
  74. if ($entry == "." or $entry =="..") {
  75. continue;
  76. }
  77. if (is_dir($dirfos.$entry)) { /// is_dir bug???
  78. continue;
  79. }
  80.  
  81. if (is_file($dirfos.$entry)) {
  82.  
  83. @unlink($dirfos.$entry);
  84.  
  85. $mone++;
  86. }
  87. }
  88. return $mone;
  89. } else {
  90. return 0;
  91. }
  92.  
  93. }
  94.  
  95. /* get zip stream and replace on dbs */
  96. function TakeZipDB( $path , $uintid ) {
  97.  
  98. if (!@$fd = fopen($path, "rb")) {
  99. return false;
  100. }
  101.  
  102. $dbaccess = new DB_Service(DBASE_0);
  103.  
  104. $magic_quotes = get_magic_quotes_runtime();
  105. set_magic_quotes_runtime(0);
  106. $file_buffer = fread($fd, filesize($path));
  107. $file_buffer = base64_encode($file_buffer);
  108. $file_buffer .="|end_stream|"; /* help to find if longblob having more as 2.4 mb sql query size en come in or no.. */
  109. fclose($fd);
  110. set_magic_quotes_runtime($magic_quotes);
  111. $sqlreplacezip = "REPLACE INTO PAGEFILE VALUES (".$uintid.", 'zip', 'attach' ,'".$file_buffer."',".date("U").")";
  112. $kbgo = file_put_contents(CACHEWEBS."lastzibdb.dat",$sqlreplacezip);
  113.  
  114. return $dbaccess->Exec_SQL($sqlreplacezip);
  115.  
  116. if ($kbgo > 0) {
  117. return true;
  118. } else {
  119. return false;
  120. }
  121. }
  122.  
  123.  
  124.  
  125. function action_davcmszip(&$sitemap) {
  126. $this->action($sitemap);
  127. }
  128.  
  129. function init() {
  130.  
  131. }
  132.  
  133. function act() {
  134. $canno = ""; /* message action */
  135. $openzipondir = "/root/"; /* on place wo not is permission to write! default ! */
  136. $filewriter = ROOT_WWW_DIR."map/datazip.xml"; /* file mit retour info */
  137. $code = $this->getParameterDefault("code"); /* file mit retour info */
  138. $methodbrowser = strtolower($_SERVER['REQUEST_METHOD']);
  139. $kb=0;
  140. $errors="";
  141. $canno="";
  142. $teile = @explode("/", $code);
  143. $filenr = $teile[0];
  144. $methode = $teile[1];
  145. $usefile = $teile[2];
  146.  
  147.  
  148. $oneday_yahr = date('Y',$filenr);
  149. $oneday_month = date('m',$filenr);
  150. $oneday_tag = date('d',$filenr);
  151. $userbasedir = "data/".$oneday_yahr."/".$oneday_month."/".$oneday_tag."/";
  152. $basedir = ROOT_WWW_DIR."data/".$oneday_yahr."/".$oneday_month."/".$oneday_tag."/";
  153. $basepagedir = $basedir.$filenr."/";
  154. $imageedir = $basedir.$filenr."/album/";
  155. $datadir = $basedir.$filenr."/data/";
  156. $subjektfile = $basedir.$filenr.".zip";
  157.  
  158.  
  159. if ($methodbrowser == "get" && $methode !="remove") {
  160. $canno .="Test envoirment|";
  161. $canno .="Usage filenr/data/zip/ to create page.|";
  162. $canno .="Usage cache/remove/file/ to drop cache file.|";
  163. }
  164.  
  165. if ($methodbrowser == "put" && $methode =="data") {
  166. $canno .="Accept upload.|";
  167. }
  168.  
  169. if (!isset($_COOKIE['Xserial'])) {
  170. $errors .="You dont have a serial permission denied!|";
  171. } else {
  172.  
  173. if (is_numeric($filenr) && $methode =="data") {
  174. if ($_COOKIE['Xserial'] == QTSERIAL) {
  175. $canno .="Your serial is correct.|";
  176.  
  177. if ($this->Make_Dir($basedir)) {
  178. $canno .="Dir exist page|";
  179. if ($methodbrowser == "put") {
  180. $canno .="Reading input.|";
  181. ///////@unlink($subjektfile);
  182. $content = file_get_contents("php://input");
  183. $kb=file_put_contents($subjektfile,$content);
  184. /* replace zip on db here */
  185. $this->Reset_Dir($imageedir);
  186. $this->Reset_Dir($datadir);
  187. $this->Reset_Dir($basepagedir);
  188. $zipreq = @exec(escapeshellcmd('unzip '.$subjektfile.' -d '.$basedir));
  189. $this->ResetCache();
  190. if ($this->TakeZipDB($subjektfile,$filenr)) {
  191. $canno .="Zip ON DB OK|";
  192. }
  193. @unlink($subjektfile);
  194. $canno .="Unzip MSG start.|";
  195. $canno .=$zipreq.".|";
  196. $canno .="Unzip MSG stop.|";
  197. }
  198.  
  199. }
  200. }
  201. }
  202.  
  203. }
  204.  
  205.  
  206.  
  207.  
  208.  
  209.  
  210.  
  211. $dml = new XML('1.0', 'utf-8');
  212. $root = $dml->createElement('dav_zip_upload');
  213. $root->setAttribute('methode',$methode);
  214. $root->setAttribute('httpm',$methodbrowser);
  215. $root->setAttribute('filenr',$filenr);
  216. $root->setAttribute('usefile',$userbasedir);
  217.  
  218. if (isset($_COOKIE['Xserial'])) {
  219.  
  220. if ($_COOKIE['Xserial'] == QTSERIAL) {
  221. $root->setAttribute('youserial',"1");
  222. } else {
  223. $root->setAttribute('youserial',"NULL");
  224. }
  225. }
  226.  
  227. $root->setAttribute('buildindate',date("U"));
  228. $root->setAttribute('hbuild',date("d.m.Y-G:i:s"));
  229.  
  230.  
  231.  
  232.  
  233. $root->setAttribute('kb_in',$kb);
  234. $dml->appendChild($root);
  235. $nome = $dml->createElement("message",$canno);
  236. $root->appendChild($nome);
  237.  
  238. $erno = $dml->createElement("erno",$errors);
  239. $root->appendChild($erno);
  240.  
  241. $dxbio = $dml->saveXML();
  242. @file_put_contents($filewriter,$dxbio);
  243. return array("message" => "how take message");
  244. }
  245.  
  246. }
  247.  
  248. ?>
To copy to clipboard, switch view to plain text mode