Complete Upload Script for uploading the Video

Getting into LiveCode for iOS? Ask your questions here.

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller, robinmiller

Post Reply
pkmittal
Posts: 111
Joined: Thu Feb 08, 2007 11:27 am
Contact:

Complete Upload Script for uploading the Video

Post by pkmittal » Wed Sep 19, 2012 10:14 am

Hi, I used the mergeAv externals and it looks like good plugin for picking up the videos from iPad. For me, It worked perfectly.

Now I am looking for complete upload script for uploading the videos on the server. ( It could have progress bar and also proper way of handing internet connection if goes down for few seconds..)

Are there already such scripts or good set of stacks available which one could purchase ?

Here is the sample code I tried but does not work well..

Code: Select all

put baseURL & "/uploadVideo.php" into urlString
post url("binfile:" & nameOfFile) to URL (urlString)
Here is uploadVideo.php Code.

Code: Select all

<?php
set_time_limit(3600);
   $filename = $_FILES['userfile']['name']; 
   if($_FILES['userfile']['error']!= UPLOAD_ERR_OK){
		error_log("failed");
		}
   if(move_uploaded_file($_FILES['userfile']['tmp_name'], "./".$filename)){
         echo 'Your file upload was successful'; // It worked.
		 }
  else{
         echo 'There was an error during the file upload.  Please try again.'; // It failed :(.
  }
?>

Please help me what should I change at the level of RunRev Script and also at the level of PHP Script..

Thanks
Best Regards
Pradeep

pkmittal
Posts: 111
Joined: Thu Feb 08, 2007 11:27 am
Contact:

Re: Complete Upload Script for uploading the Video

Post by pkmittal » Mon Sep 24, 2012 9:43 am

I found some code which was written by Harald Müller. but not sure how to fix and complete

Code: Select all

on mouseUp
   answer file "Testfile:" of type "PNG"
   Put url ("binfile:/" & it) into myFile
   put makeMultipart(myFile) into myFile
   post myFile to URL "http://www.server.com/upload.php"
   answer it
end mouseUp

function makeMultipart myFile
   -- build header
   put "POST /upload.php HTTP/1.0" & return into myHeader
   put "Host: www.server.com" & return after myHeader
   put "Date: " & the internet date & return after myHeader
   put "Content-Type: multipart/form-data; boundary=uploadToHost" & return after myHeader
   put "Content-Length: " & (the number of chars of myFile) & return after myHeader
   put return after myHeader
   set the httpHeaders to myHeader
   -- build data
   put "--uploadToHost" & return into myContainer
   put "Content-Disposition: form-data; name=" & quote & "test.png" & quote & return after myContainer
   put "Content-Type: image/png" & return after myContainer
   put "Content-transfer-encoding: binary" & return after myContainer
   put return after myContainer
   put myFile & return after myContainer
   put "--uploadToHost--" & return after myContainer
   return myContainer
end makeMultipart




pkmittal
Posts: 111
Joined: Thu Feb 08, 2007 11:27 am
Contact:

Re: Complete Upload Script for uploading the Video

Post by pkmittal » Thu Sep 27, 2012 8:47 am

Is there any expert who can help us in writing the upload script in LiveCode at client side.. The server side script I would be able to write in PHP.

Hope, We can achieve upload of videos using HTTP Post for iOS.

Post Reply

Return to “iOS Deployment”