HTTP POST File Upload FAQ

From Fliqz FAQ

Jump to: navigation, search

Contents

Introduction

The HTTP POST Feature is available only on Paid Silver and Gold Fliqz Accounts.

The Fliqz HTTP POST Uploader provides the ability for a Web Developer to generate a fully customized Upload Form that complies with your Web Site Design. Fliqz provides an HTTP POST Handler that will gather information from your HTTP Form and upload a corresponding file to Fliqz. Upon completion of the processing, the HTTP POST handler will return information that will help you identify the Asset you have Uploaded and subsequently reference the Asset.

Since this is a standard HTTP Form, you are free to design the form in any way that meets your needs. Any pre-processing or validation of form entries you feel is necessary in order to ensure the integrity of the data you supply to Fliqz along with the Asset file can be included in the Form.

Meta Data Collection

You are not required to collect data when a file is uploaded. It is possible to upload a file without any corresponding meta data. However, should you desire to capture metadata along with the file, there are several options available to you with the HTTP POST Uploader.

Standard Meta Data Fields

  • Title
  • Description
  • Keywords

These fields are standard attributes available for every Video. One ore more of these fields can be revealed on your form and each can be made a required entry based on your own handling of the form prior to executing the Form Action and the Fliqz HTTP POST handler.

Success and Error Pages

Depending on the outcome of the HTTP POST operation you can choose to have the HTTP POST handler re-direct to a page of your choice. Upon success, you can specify a page to direct your users. Upon encountering an error, you specify a page which will handle error conditions returned by the HTTP POST handler.

The Uploader will return the Video ID to the Success page, in addition Hidden fields can be used to identify additional data collected on the HTTP Form to be passed on the the Success page. These techniques can be used to gather data about the Video and store it locally, as a backup or as a supplement to the data stored in the Fliqz repository.

If an error is encountered during processing of an HTTP POST method against the Fliqz HTTP Post Handler, and an Error page has been identified as a re-direct, an error code will be sent to the Error page, along with any data specified in Hidden fields.

Hidden Fields

Hidden fields that will either pass back name/value pairs to a page you specify or add additional meta data to the Fliqz database for the Asset you are Uploading.

For example, if you are tracking information about the User, User Account, or Web Page from which the Upload occurs, you can track this information in hidden Form Fields and pass them to your Success and/or Error pages, or capture them as Meta Data associated with the Video in the Fliqz Database. The Fliqz HTTP POST Uploader provides a number of methods of tracking data in hidden fields.

Location

The HTTP POST Upload handler is exposed at the following URL:-

API

Request

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 No text string Title
A short (less than 50 characters) title of the asst.
txtDescription No text string Description
A description (a maximum 1000 characters) of the asset.
txtKeywords No 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.

Response

Query Parameters

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.

Note that other query parameters may be returned when specified using the hdnPassbackFields and hdnPassbackParameters elements.

HTTP Status Codes

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.

Using an HTTP form Element

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

Changes from Previous Release

A few things have changed in this release that support a new platform Fliqz will be building on going forward. Fliqz will be introducing new features based on this platform in the future. A few of these features appear in this release in the context of the HTTP POST Uploader.

Account ID vs. Application ID

The Legacy HTTP POST Uploader used an Account ID as a target to route Asset Uploads to your account in the Fliqz repository. This approach will continue to be supported. As a means of improving the overall security, Fliqz has established a new concept of Application IDs. If you choose to make use of the HTTP POST Uploader, an Application ID will be established for your account.

This approach provides an extra level of security to ensure that your account information is not publicly avaiable.

If you have a Silver or Gold Account Plan, Contact Fliqz at support@fliqz.com to acquire your HTTP POST Application ID.

Unsupported Functionality

Functionality which has been removed since the previous release.

Parameters

The following HTTP POST parameters are no longer supported:-

Parameter Name Input Tag Type Data Type Description
hdnPartnerUserID hidden int The user ID. This must be specified in conjunction with the hdnAlbumID.
hdnAlbumID hidden int The user album ID. This must be specified in conjunction with the hdnPartnerUserID.
hdnUniqueSessionID hidden string A ID parameter which is returned in the form of the uniqID query parameter in a successful or unsuccessful response.
hdnAddlParamToPassBack hidden string An additional parameter which is passed back in the form of the addlParam query parameter in a successful or unsuccessful response.


Sample Page

<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, .3gp, .dv, .qt, .asf, .mp3, .wav, .wma, .qcelp, .amr-nb, .movieclip, .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="hdnRedirecTo" name="hdnRedirectTo" value="postsuccesspage.php" type="hidden" />
          <input id="hdnRedirectOnErrorTo" name="hdnRedirectOnErrorTo" value='posterror.php' type="hidden" />
        </form>
      </td>
    </tr>
  </table>
</div>
</body>
</html>

Anatomy of the Sample Code

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

Form Action

Set to use the Fliqz HTTP POST Handler.

txtTitle

In this form, title is set as a Required Field, the Fliqz Upload Handler will take the data and store it as the Title of the Video.

FileUploadedVideo

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 Fliqz Server. Once recieved, the file will be queued for encoding to a format suitable for playback on the web.

txtDescription

In this form, description is set as a Required Field, the Fliqz Upload Handler will take the data and store it as the Description of the Video.

txtKeywords

In this form, keywords are set as an Optional Field, the Fliqz Upload Handler will take the data and store it as the Keywords associated with the Video.

Terms

It is important that your Upload form include a link to your terms. Users must agree to terms before uploading to the Fliqz platform. These Terms MUST meet the intent of the Fliqz Terms specified here: Fliqz Terms

Submit

The submit button will execute the javascript function ValidateVideoUploadForm()when clicked, if all validation checks are satisfied, the form action (the Fliqz Upload Handler) will recieve the POST Method from the Form. The response from the Fliqz Upload Handler will be passed either to the success or the error form depending on the result of the action.

lblError

This is the target used by the javascript ValidateVideoUploadForm() function to display errors or to show the status of the upload process.

hdnADCID

Contains the Application ID associated with the HTTP POST application associated with your account.


hdnPassbackQueryParameters

This optional setting can be used to send additional name-value pairs back to your pages. These values are not stored in the Fliqz 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.

hdnRedirecTo

A valid path and filename for a page to direct a successful HTTP POST transaction.

hdnRedirectOnErrorTo

A valid path and filename for a page to direct an unsuccessful HTTP POST transaction.

Sample Query Parameters

The following represents a query string returned by the Fliqz 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 that 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.

Other Questions

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.

Personal tools