日期:2014-05-16 浏览次数:20356 次
jsp页面
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>API上传例子</title> <script src="http://code.jquery.com/jquery-1.10.1.min.js"></script> <script src="http://code.jquery.com/jquery-migrate-1.2.1.min.js"></script> </head> <script type="text/javascript"> function doFileUpload(){ form = document.getElementById("create_video_sample"); buildJSONRequest(form); form.action = document.getElementById("yourAPILocation").value; form.submit(); } function buildJSONRequest(form){ json = form.JSONRPC //Construct the JSON request: json.value = '{"writetoken": "'+ document.getElementById("yourWriteToken").value + '","title": "'+ document.getElementById("name").value + '","describ":"'+ document.getElementById("describ").value + '","tag":"'+ document.getElementById("shortDescription").value + '","Filedata.filename":"'+ document.getElementById("Filedata").value + '"}'; form.JSONView.value = json.value; form.writetoken.value=document.getElementById("yourWriteToken").value; form.title.value=document.getElementById("name").value; form.describ.value=document.getElementById("describ").value; form.tag.value=document.getElementById("shortDescription").value; form.filename.value=document.getElementById("Filedata").value; } </script> <div style="float:left; width:450px;"> <div style="font-weight:bold;font-size:24">API上传示例</div> <br/> <table style="width:50%"> <tr><td style="width:20%">Write Token: </td><td style="width:100%"><input id="yourWriteToken" size="55" value="Le1haiIrp60WacW-s5Hg60RTtFkbTf9q"/><br/> </td></tr> <tr><td>API Location: </td><td><input id="yourAPILocation" size="55" value="http://fgdf/uc/services/rest?&method=upload" /></td></tr> <tr><td>标题: </td><td><input type="text" id="name" name="title2" size="55" /></td> <tr><td>标签: </td><td><input type="text" id="shortDescription" size="55" /></td></tr> <tr><td>描述: </td><td><input id="describ" size="55" type="text"/></td></tr> <br/> <br/> <form id="create_video_sample" method="POST" ENCTYPE="multipart/form-data" target="postFrame"> <!--This is where the actual json request lives, it has to come before the file input --> <input type="hidden" name="JSONRPC" /> <input type="hidden" name="writetoken" /> <input type="hidden" name="title" /> <input type="hidden" name="describ" /> <input type="hidden" name="tag" /> <input type="hidden" name="filename" /> <input type="hidden" id="time" name="time"/> <input type="hidden" id="clientHash" name="clientHash"/> <tr><td>File:</td><td><input type="file" name="Filedata" id