0

I like the drag & drop feature of the skydrive file upload control. How do i go about developing a similar control?

pnuts
  • 58,317
  • 11
  • 87
  • 139
SBB
  • 155
  • 1
  • 7

3 Answers3

0

Here is a SilverLight solution I found:

http://www.silverlightshow.net/items/SL4-Desktop-Drag-and-Drop-Silver-Sky.aspx

Edward Olamisan
  • 800
  • 1
  • 18
  • 28
0

C# will only assist you at the sever side of this feature, most of it uses Java Script (client side) to upload the files in a pretty AJAX way (very similar to GMail attachments). You can use the following example to implement something similar to Skydrive's.

This can assist you of implementing the asynchronous upload part.

Community
  • 1
  • 1
Eran Betzalel
  • 4,105
  • 3
  • 38
  • 66
0

check my source code if it's useful

using System;
using System.Data.ProviderBase;
using System.Text;
using System.Xml.Schema;
using System.Xml.XPath;
using System.Xml.Xsl;
using System.Globalization;
using System.Diagnostics;
using System.ComponentModel.Design;
using System.Data.Common;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.Collections;
using System.Data;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Configuration;
using System.Web.Security;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }

    protected void upload_Click(object sender, EventArgs e)
    {
if (fileupload.HasFile)
try {

    fileupload.SaveAs("C:\\Uploads\\" + fileupload.FileName);
lbl.Text = "File name: " +
fileupload.PostedFile.FileName + "<br>" +
fileupload.PostedFile.ContentLength + " kb<br>" +
"Content type: " +
fileupload.PostedFile.ContentType;  
}
catch (Exception ex) {
lbl.Text = "ERROR: " + ex.Message.ToString(); 
}
else
{
lbl.Text = "You have not specified a file.";
} 
    }
}

HTML:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="fileupload.aspx.cs" Inherits="_Default" %>

<!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>
</head>
<body>
<form id="myForm" runat="server">

<asp:FileUpload ID="fileupload" runat="server" />

<asp:Button ID="upload" Text="Upload" runat="server" onclick="upload_Click" />

<asp:Label ID="lbl" runat="server"></asp:Label>
</form>
</body>
</html>
Jason Plank
  • 2,336
  • 5
  • 31
  • 40