biggieuk Posted January 14, 2008 Share Posted January 14, 2008 Hi all, Im looking for advice and guidance to achieve the following results. I am using PHPTube - http://kamleitner.com/code/phptube-youtube-api-f-video-upload-download/ (This enables me to upload the file to my server then upload that file automatically to youtube.) I want to have a web page that allows the user to browse for a video file and click submit to upload this file to my server. I have managed to get this part working. I am looking to enhance this a little by displaying a progression bar or animation on the same page whilst the upload is taking place. Currently once the Submit button has been clicked a seperate .php page is loaded which displays the following details: <?php if ($_FILES["file"]["size"] < 500000) { if ($_FILES["file"]["error"] > 0) { echo "Return Code: " . $_FILES["file"]["error"] . "<br />"; } else { echo "Upload: " . $_FILES["file"]["name"] . "<br />"; echo "Type: " . $_FILES["file"]["type"] . "<br />"; echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />"; echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br />"; echo "<img src='load.gif'>"; if (file_exists("upload/" . $_FILES["file"]["name"])) { echo $_FILES["file"]["name"] . " already exists. "; } else { move_uploaded_file($_FILES["file"]["tmp_name"], "upload/" . $_FILES["file"]["name"]); echo "Stored in: " . "upload/" . $_FILES["file"]["name"]; //upload video to youtube include_once ("phptube.php"); //$tube = new PHPTube (); //$tube->download("yTF3jS16Sbc","demo.flv"); $tube = new PHPTube ($_POST["uName"],$_POST["uPass"]); $id = $tube->upload ("upload/" . $_FILES["file"]["name"], $_POST["uTitle"], $_POST["uTags"], $_POST["uDescription"],10, "EN", $_POST["uPublic"]); } } } else { echo "Invalid file"; } ?> Does anybody have any idea how i can upload the file to my server without loading up a separate page and display an upload animation whilst doing so? thanks for help with this. Dan Quote Link to comment https://forums.phpfreaks.com/topic/85965-upload-file-to-server-question/ Share on other sites More sharing options...
roshanbh Posted January 14, 2008 Share Posted January 14, 2008 To upload the file to the server without loading up a separate page and to display a upload animation you have to use ajax for this. This link might be helpful for u http://php5.bluga.net/UploadProgressMeter/demo.php. Roshan Bhattarai http://roshanbh.com.np Quote Link to comment https://forums.phpfreaks.com/topic/85965-upload-file-to-server-question/#findComment-438947 Share on other sites More sharing options...
biggieuk Posted January 14, 2008 Author Share Posted January 14, 2008 thanks for your reply, is it possible to simply show the 'loading.gif' animation next to the submit button whilst the file is uploading, then hide again once the file has been completed? thanks. Quote Link to comment https://forums.phpfreaks.com/topic/85965-upload-file-to-server-question/#findComment-438987 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.