Problem uploading the video file!!!
Hi All,
I have suppose to upload videos from my flash form,The problem is i can able to upload small size of files such as 150KB but when i upload some big size videos more then 1MB it won’t work.
ActionScript Code:
/* */ uploadMsg.visible = false; var URLrequest:URLRequest = new URLRequest("http://localhost/udip/File_Upload/uploader_script.php"); var imageTypes:FileFilter = new FileFilter("Movies (*.flv, *.mov, *.wmv)", "*.flv; *.mov; *.wmv"); var allTypes:Array = new Array(imageTypes); var fileRef:FileReference = new FileReference(); fileRef.addEventListener(Event.SELECT, syncVariables); fileRef.addEventListener(Event.COMPLETE, completeHandler); fileRef.addEventListener(ProgressEvent.PROGRESS, progressHandler); upload_btn.addEventListener(MouseEvent.MOUSE_DOWN,syncVariablesM); browse_btn.addEventListener(MouseEvent.CLICK, browseBox); upload_btn.addEventListener(MouseEvent.CLICK, uploadVars); function browseBox(event:MouseEvent):void { fileRef.browse(allTypes); } function uploadVars(event:MouseEvent):void { uploadMsg.visible = true; fileRef.upload(URLrequest); upload_btn.visible = true; } function syncVariables(event:Event):void { fileDisplay_txt.text = "" + fileRef.name; blocker.visible = false; upload_btn.visible = true; progressBar.width = 2; var variables:URLVariables = new URLVariables(); variables.video_title = video_title.text; variables.video_description = video_description.text; variables.terms_cond = terms_cond.selected; variables.terms_cond = upload_file_owner.selected; URLrequest.method = URLRequestMethod.POST; URLrequest.data = variables; } function syncVariablesM(event:MouseEvent):void { fileDisplay_txt.text = "" + fileRef.name; blocker.visible = false; upload_btn.visible = true; progressBar.width = 2; var variables:URLVariables = new URLVariables(); variables.video_title = video_title.text; variables.video_description = video_description.text; variables.terms_cond = terms_cond.selected; variables.terms_cond = upload_file_owner.selected; URLrequest.method = URLRequestMethod.POST; URLrequest.data = variables; } function completeHandler(event:Event):void { uploadMsg.visible = false; blocker.visible = true; status_txt.text = fileRef.name + " has been uploaded."; fileDisplay_txt.text = ""; video_description.text = ""; video_title.text = ""; upload_file_owner.selected = false; terms_cond.selected = false; } function progressHandler(event:ProgressEvent):void { trace("uploading"); progressBar.width = Math.ceil(200*(event.bytesLoaded/event.bytesTotal)); }
php:
ActionScript Code:
<?php /* */ // Set local PHP vars from the POST vars sent from flash $todayDate = $_POST['todayDate']; $photo_title = $_POST['video_title']; $photo_description = $_POST['video_description']; $filename = $_FILES['Filedata']['name']; $filetmpname = $_FILES['Filedata']['tmp_name']; $fileType = $_FILES["Filedata"]["type"]; $fileSizeMB = ($_FILES["Filedata"]["size"] / 1024 / 1000); // Place file on server, into the images folder move_uploaded_file($_FILES['Filedata']['tmp_name'], "images/".$filename); // This section edits your log file, if you don't need a text log file just delete these lines $myFile = "logFile.txt"; $fh = fopen($myFile, 'a') or die("can't open file"); $stringData = "\n\ntodayDate: $todayDate \n video_title: $video_title \n video_description: $video_description \n ssid: $terms_cond \n upload_file_owner: $upload_file_owner \n TmpName: $filetmpname \n Type: $fileType \n Size: $fileSizeMB MegaBytes"; fwrite($fh, $stringData); fclose($fh); // End log file edit ?>
So I want to know,Is there any limitation for uploading size in flash.
Thank you,
Original post by illangoo