| HTTP POST File Upload | |
Introduction
Meta Data Collection
|
|
The HTTP POST Upload handler is exposed at the following URL:
- http://upload.fliqz.com/handlers/20081222/HttpPostUploadHandler.ashx
The handler recognizes the following HTTP Post parameters:
NOTE: When implementing these Parameters be sure to set the parameter name as specified in the Parameter name column. You may include a corresponding id, however, not in lieu of a parameter name reference. For example:
<INPUT id="hdnPassbackQueryParameters" name="hdnPassbackQueryParameters" type="hidden" />
Parameter Name Required Input Tag Type Data Type Description hdnADCID Yes hidden GUID Application ID
The ID of a HTTP POST upload application configuration associated with your account. This may be identified by contacting Fliqz Customer Services.txtTitle Yes text string Title
A short (less than 50 characters) title of the asst.txtDescription Yes text string Description
A description (a maximum 500 characters) of the asset.txtKeywords Yes text string Keywords
A set of keywords. Keywords are separated by a space or comma. The maximum size of the string is 200 characters.hdnPassbackParameters No hidden string Passback MetaData Parameters
Identifies the names of HTTP POST parameters which are used to append information, in the form of query parameters, to the result URL (irrespective of whether a success or failure page). The name (or Id) of the identified field is used as the name of the query parameter whilst the value of the field is used as the value of the query parameter. Fields are identified by their respective IDs, with each ID separated by a comma or space. This is an alternative means for passing information between the upload page and any subsequent pages. (Both the Success and Error pages)
Please note that if the hdnPassbackFields element identifies any hidden elements then they must be direct children of any form element to be retrieved.hdnPassbackQueryParameters No hidden string Passback Query Parameters
Contains a collection of query parameters which are appended to the result URL (irrespective of whether a success or failure page). The query parameters are in the form of name/value pairs (myParam=myParamValue) separated by ampersands.(myParam=myParamValue&myParam1=myParamValue1)
This provides the means for passing information between the upload page and any subsequent pages. (Both the Success and Error pages)hdnRedirectTo No hidden string Success Page
A URI which is invoked in response to a successful upload. The id query parameter, containing the ID of the uploaded asset, is appended to the URI. In addition, other query parameters, identified by the hdnParameterFields elements may also be included. If this is not specified then the response returns to the original URI - although the relevant query parameters are still appended.hdnRedirectOnErrorTo No hidden string Error Page
A URI which is invoked in response to a unsuccessful upload. The errId query parameter, containing the ID of the error, is appended to the URI. In addition, other query parameters, identified by the hdnParameterFields elements may also be included. If this is not specified then the response returns to the original URI - although the relevant query parameters are still appended.hdnFileSelectControlName No hidden string File Information
The name of the file select control which contains the file to be uploaded. This element is only required where the form contains more than one file select control and it is necessary to distinguish between the Fliqz file select control and a File select control you have incorporated into the form for some other purpose.The handler returns the following query parameters:
Query Parameter State Description id Success Identifies the ID of the sucessfully uploaded asset. errId Failure Identifies the error ID in response to a failed upload.
The handler returns the following responses (in the form of HTTP status codes):
HTTP Status Code Meaning Description 200 OK This is always returned when a redirect has been specified. It is also returned on a successful upload where the response returns to the original page. 400 Bad Request Returned when the original request is invalid - either missing mandatory information or when attempting to upload an invalid file type. A GUID is attached identifying the error. 500 Internal Server Error Returned when a server side error occurs. A GUID is attached identifying the error.
The action of the form is the URI of the handler - i.e. http://upload.fliqz.com/handlers/20081222/HttpPostUploadHandler.ashx.
The name of the HTTP POST parameter is mapped to the control name of a successful control.
Hidden elements MUST be specified as direct children of the form element or they will be ignored. Other types of controls can be placed anywhere within the form element.
For a more detailed explanation of how to submit data for form processing please see this and this
If you have a Silver or Gold Account Plan, Contact VBrick at support@fliqz.com to acquire your HTTP POST Application ID.
head>
<title>Fliqz Uploader - HTTP POST</title>
<script>
/*
* Validates that the video to be uploaded is in one of the appropriate formats.
* supportedFormats: The supported formats.
*/
function ValidateVideoUploadForm(supportedFormats)
{
var error = document.getElementById("lblError");
var name = document.getElementById("txtTitle");
var desc = document.getElementById("txtDescription");
var file = document.getElementById("FileUploadedVideo");
var hdnP = document.getElementById("hdnPassbackQueryParameters");
hdnP.value = hdnP.value + "&File=" + file.value ;
//alert(hdnP.value);
if(name !=null && name.value == 0)
{
error.innerHTML = "Please enter a Video Title";
return false;
}
var FilePath = document.getElementById("FileUploadedVideo");
if(FilePath.value == 0)
{
error.innerHTML = 'Please select a Video to upload';
return false;
}
var Terms = document.getElementById("cbTerms");
if(!Terms.checked)
{
error.innerHTML = 'Please indicate your acceptance of the Terms of Use by checking the box';
return false;
}
fileExtension = FilePath.value.split(".");
//alert(supportedFormats.indexOf(fileExtension[fileExtension.length - 1]));
if(supportedFormats.indexOf(fileExtension[fileExtension.length - 1].toLowerCase()) < 1)
{
error.innerHTML = 'Fliqz supports the following video formats: '+ supportedFormats;
return false
}
error.innerHTML = "Video uploading, Please wait...";
}
</script></head>
<body>
<div id="wrapper">
<table id="content" cellspacing="0" cellpadding="0">
<tr>
<td id="bodyfull"><div style="margin-left: 75px;">
<h3> Sample File Upload Page - Post Method</h3>
<span style="color: Red">*</span> = Required<br />
<hr />
</div>
<form action='http://upload.fliqz.com/handlers/20081222/HttpPostUploadHandler.ashx' enctype="multipart/form-data"
method="post" id="Form1">
<table id="Table1" style="width: 700px; height: 427px" cellspacing="0" cellpadding="0"
width="600" border="0">
<tr>
<td></td>
<td valign="top">
<table id="Table2" cellspacing="1" cellpadding="1" width="600px" border="0">
<tr>
<td class="labels"><span style="color: Red">*</span> Video Title: </td>
<td colspan="3"><input name="txtTitle" id="txtTitle" value="Enter Video Title Here" maxlength="50"
size="50" />
<!-- A short (less than 50 characters) title of the asst. -->
</td>
</tr>
<tr>
<td class="labels"><span style="color: Red">*</span> Video File: </td>
<td colspan="3"><input type="file" id="FileUploadedVideo" name="FileUploadedVideo" />
</td>
</tr>
<tr>
<td style="width: 300px"></td>
<td colspan="3"><b>NOTE: One Video</b> per upload </td>
</tr>
<tr>
<td class="labels" valign="top"> Video Description: </td>
<td colspan="3"><textarea name="txtDescription" id="txtDescription" rows="5" cols="50" maxlength="1000">Enter Description Here</textarea>
<!-- A description (a maximum 1000 characters) of the asset. -->
</td>
</tr>
<tr>
<td class="labels" valign="top"> Keywords: </td>
<td colspan="3"><textarea name="txtKeywords" id="txtKeywords" rows="2" cols="50" maxlength="200"></textarea>
<!-- A set of keywords. Keywords are separated by a space or comma.
The maximum size of the string is 200 characters. -->
</td>
</tr>
<tr>
<td class="labels"></td>
<td colspan="2"><br/>
<input id="cbTerms" name="cbterms" type="checkbox" checked="checked" />
I accept the <a href="Terms.htm" target="_blank"> Terms of Use</a> </td>
<td align="right" valign="bottom"><input id="Submit1" onClick="return ValidateVideoUploadForm('.mov, .avi, .flv, .mpeg, .wmv, .mpg, .mp4, .m4v, .3gp, .dv, .qt, .asf, .mp3, .wav, .wma, .qcelp, .amr-nb, .mts, .mod, .3g2');"
type="submit" value="Submit" name="Submit1" />
</td>
</tr>
<tr><td></td>
<td colspan="3">
<label id="lblError" class="error">
</label>
</td></tr>
</table>
</td></tr>
</table>
<input id="hdnADCID" name="hdnADCID" value="00000000-0000-0000-0000-000000000000" type="hidden" />
<input id="hdnPassbackParameters" name="hdnPassbackParameters" type="hidden" value ="txtTitle,txtDescription,txtKeywords"/>
<input id="hdnPassbackQueryParameters" name="hdnPassbackQueryParameters" value="method=HTTPPost" type="hidden" />
<input id="hdnRedirectTo" name="hdnRedirectTo" value="postsuccesspage.php" type="hidden" />
<input id="hdnRedirectOnErrorTo" name="hdnRedirectOnErrorTo" value='posterror.php' type="hidden" />
</form>
</td>
</tr>
</table>
</div>
</body>
</html>In order of Appearance:
ValidateVideoUploadForm(supportedFormats)
This javascript function serves a few purposes:
- Ensures that required fields are populated
- Ensures that User has agreed to Terms
- Ensures that the extension of the file represents a supported Video File Format (A list of file extensions is passed to the function, see the OnClick event on the Form Submit Button)
- Reports the status of these Validation Checks to the User
Set to use the VBOSS HTTP POST Handler.
In this form, title is set as a Required Field, the VBOSS Upload Handler will take the data and store it as the Title of the Video.
Of course the File is required, the file path\name is passed on to the Upload Handler, the file is uploaded and stored on the VBOSS Server. Once recieved, the file will be queued for encoding to a format suitable for playback on the web.
In this form, description is set as a Required Field, the VBOSS Upload Handler will take the data and store it as the Description of the Video.
In this form, keywords are set as an Optional Field, the VBOSS Upload Handler will take the data and store it as the Keywords associated with the Video.
It is important that your Upload form include a link to your terms. Users must agree to terms before uploading to the VBOSS platform. These Terms MUST meet the intent of the VBOSS Terms specified here: VBOSS Terms
The submit button will execute the javascript function ValidateVideoUploadForm()when clicked, if all validation checks are satisfied, the form action (the VBOSS Upload Handler) will recieve the POST Method from the Form. The response from the VBOSS Upload Handler will be passed either to the success or the error form depending on the result of the action.
This is the target used by the javascript ValidateVideoUploadForm() function to display errors or to show the status of the upload process.
Contains the Application ID associated with the HTTP POST application associated with your account.
This optional setting can be used to send additional name-value pairs back to your pages. These values are not stored in the VBOSS Repository, they are simply passed through to your page. This may be helpful if you are tracking a user, or status to maintain context within your site for your user.
A valid path and filename for a page to direct a successful HTTP POST transaction.
A valid path and filename for a page to direct an unsuccessful HTTP POST transaction.
The following represents a query string returned by the VBOSS Upload Handler:
postsuccesspage.php?id=d9c173f260614e6fae68619a299574d8&&txtTitle=Enter%20Video%20Title%20Here
&txtDescription=Enter%20Description%20Here&txtKeywords=test&method=HTTPPost
&File=Site%20III%20video%20beach.mpg&File=surfer.mov
Please Note: id=d9c173f260614e6fae68619a299574d8, is a unique id that can be used to track the video uploaded to your account. A similar ID will be passed to the Error page which can be sent to support@fliqz.com to assist in troubleshooting issues with the Fliqz Upload Handler.
How do I limit the type of media files to be uploaded?
You can use a Javascript function to limit the types of files which can be uploaded. This function can be called when the submit button is clicked to allow validation before upload.
/*
* Validates that the file to be uploaded is in one of the appropriate formats.
* supportedFormats: The supported formats in the form of a string with each extension (including period)
separated by a space.
* fileName: The name of the file (including extension).
* Returns a boolean flag.
*/
function ValidateFileFormat(supportedFormats, fileName)
{
if(fileName !=null && fileName.value != 0)
{
fileExtension = fileName.value.split(".");
if(supportedFormats.indexOf(fileExtension[fileExtension.length - 1].toLowerCase()) > 0)
{
return true;
}
}
return false;
}Why don't you provide progress information?
There is no native mechanism for an HTTP POST upload handler to provide progress information. Indeed, as described above, the HTTP POST upload handler is only notified when the file is completely uploaded.