Seven Qiniu storage uploads C # ASP.

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.