开发者

how to set file path name from asp.net code behind for uploading videos using youtube api?

开发者 https://www.devze.com 2023-02-20 19:49 出处:网络
I am trying to set file path name which i already have on my computer.. i want to upload this file which i have in my comp to my acnt in youtube using its api..

I am trying to set file path name which i already have on my computer.. i want to upload this file which i have in my comp to my acnt in youtube using its api.. everythins wo开发者_如何学编程rkin if i hav to do manual file click nd selcting file nd den clicking upload to upload the selected file. what i want is to set the file name which i have nd not do manual selection of file using html's file control. here's the code

protected void Page_Load(object sender, EventArgs e)
    {
        String url = HttpContext.Current.Session["form_upload_url"] as string;
        String redirect = HttpContext.Current.Session["form_upload_redirect"] as string;
        url += "?nexturl=" + HttpUtility.UrlEncode(redirect);
        String token1 = HttpContext.Current.Session["form_upload_token"] as string;


        this.Form.Action = url;
        token.Value = token1;

       ****file1.Value = @"C:\Documents and Settings\rijor\Desktop\Al Dura affair the 10 seconds never shown by France 2.wmv";****

    }

i m not able to set file1. value ppt cauz i get this error "The value property on HtmlInputFile is not settable." my aspx page for this is

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs"         Inherits="WebApplication2.WebForm1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title></title>
<script language="javascript" type="text/javascript">
    function submit() {
        var con = document.getElementById('iupload');
        con.click();         
       }
    function file1_onclick() {

    }

</script>

How can this be solved? thanks Rijo

0

精彩评论

暂无评论...
验证码 换一张
取 消