Hi Friends,
How can we set the folder path' we want to upload from flex? I
wrote an uploadhandler in asp. My upload handler is following.
<%@ WebHandler Language="C#" Class="FileUploadHandler" %>
using System;
using System.Web;
public class FileUploadHandler : IHttpHandler {
public void ProcessRequest (HttpContext context)
{
string applicationPath = context.Server.MapPath
(context.Request.ApplicationPath);
string folderPath = applicationPath + "/Uploads/";
string filePath = string.Empty;
System.IO.DirectoryInfo objDirectory = new
System.IO.DirectoryInfo(folderPath);
// if the directory does not exists, create it.
if (!objDirectory.Exists)
{
objDirectory.Create();
}
string result = "OK";
context.Response.ContentType = "text/plain";
if (context.Request.Files.Count > 0)
{
HttpPostedFile file = context.Request.Files[0];
try
{
filePath = folderPath + file.FileName;
file.SaveAs(filePath);
}
catch (Exception ex)
{
result = "File Upload Failed. Exception : " +
ex.Message;
}
}
else
{
result = "No File Uploaded";
}
context.Response.Write(result);
}
public bool IsReusable
{
get
{
return false;
}
}
}
Pls help me.. It is urgent...
Regards,
Hari
--
You received this message because you are subscribed to the Google Groups "Flex
India Community" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/flex_india?hl=en.