Re: Error 2038 on large upload

  •  06-13-2011, 4:54 PM

    Re: Error 2038 on large upload

    Hi greggs,
     
    You can also try the following code, if you choose files more than 2G, it will display friendly message:
    <?php require_once "phpuploader/include_phpuploader.php" ?>
    <?php session_start(); ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
     <title>Demo 2 - use UploadUrl property</title>
    </head>
    <body>
     <?php
       $uploader=new PhpUploader();
       $uploader->MultipleFilesUpload=true;
       $uploader->InsertText="Upload (Max 2G)";
       $uploader->MaxSizeKB=2048000;
       //2048000KB=2048M=2G
       $uploader->Render();
     ?>
     
     <script type='text/javascript'>
     function CuteWebUI_AjaxUploader_OnTaskComplete(task)
     {
      var div=document.createElement("DIV");
      var link=document.createElement("A");
      link.setAttribute("href","savefiles/myprefix_"+task.FileName);
      link.innerHTML="You have uploaded file : savefiles/myprefix_"+task.FileName;
      link.target="_blank";
      div.appendChild(link);
      document.body.appendChild(div);
     }
     function CuteWebUI_AjaxUploader_OnSelect(files) {  
            var selectedSize = 0;
            for (var i = 0; i < files.length; i++) {          
              if(files[i].FileSize>2*1024*1024*1024)
              {
                  alert("File size is limited to 2G");
                  return false;
              }
            }
        }
     </script>
     </body> 
    </html>
     
    Thanks for asking
View Complete Thread