Using system;using system.collections.generic;using system.linq;using system.web;using System.Web.UI;using System.web.ui.webcontrols;using qiniu.conf;using qiniu.io.resumable;using system.collections.specialized;using qiniu.rs;using qiniu.rpc;namespace bootstraplearn{public partial class Qiniutest:System.Web.UI.Page {protected VO ID Page_Load (object sender, EventArgs e) {} protected void Bt_serverclick (object sender, EventArgs e) { Qiniu_api. Putfile (ff. Value, Guid.NewGuid (). ToString ("N") + "AA"); }} public static class Qiniu_api {public static string Bucket = "";//Space name public static string domain = "";//Domain name <summary>/////</summary>/<param name= "path" > Local path </param>//<param Name= "filename" > File name </param>//<returns></returns> public static bool Putfile (string path, St Ring fileName) {BOOL flag = false; Settings putsetting = new Settings (); ResumablepuTExtra extra = new Resumableputextra (); NameValueCollection NC = new NameValueCollection (); nc. ADD ("X:username", "Qiniu"); Extra. Callbackparams = NC; Resumableput target = new Resumableput (putsetting, extra); String uptoken = new Putpolicy (Bucket). Token (New Qiniu.Auth.digest.Mac ()); string key = FileName; Target. putfinished + = new Eventhandler<callret> ((O, e) + = {if (E.ok) {flag = true; } }); Callret ret = target. Putfile (Uptoken, Path, key); return flag; } static Qiniu_api () {config.access_key = ""; AK Config.secret_key = "";//sk}}}
<%@ Page Language="C #"AutoEventWireup="true"codebehind="Qiniutest.aspx.cs"Inherits="bootstraplearn.qiniutest" %><!DOCTYPE HTML><HTMLxmlns= "http://www.w3.org/1999/xhtml"><Headrunat= "Server"><Metahttp-equiv= "Content-type"content= "text/html; charset=utf-8"/> <title></title></Head><Body> <formID= "Form1"runat= "Server"> <inputtype= "File"runat= "Server"ID= "FF" /> <inputtype= "button"runat= "Server"value= "Upload"ID= "BT"OnServerClick= "Bt_serverclick" /> </form></Body></HTML>
Transferred from: http://www.cnblogs.com/hjwtech/p/3927277.html
Seven Qiniu storage uploads C # ASP.