views:

7

answers:

0

I have a SWF which has two button one been Browse button and other bein upload. I dont Know whats the code behind the SWF file but being asked to pass flashvar variable like 'uploadURL ='+ ourl where ourl is url of the handle.aspx which handles the uploading operation I did all this and wrote code in handler.aspx which obtains file from request.files from HTTPPostedFiles Collection ... Please Help... I Wrote following code

Uploadfile.aspx < object width="550" height="400" id = "objSingleFile" >

    <param name="movie" value="SingleFileUpload.swf" \>
    <param name="FlashVars" value = "upLoadURL='UploadHandler.aspx'" id = "flashParam" \>
     <embed src="SingleFileUpload.swf" width="550" height="400" id = "embSingleFile">
    </embed>
   </object>

UploadHandler.aspx

protected void Page_Load(object sender, EventArgs e) {

    string FolderToSave = Server.MapPath("") + "\\UploadedFiles\\";
    if (Request.Files != null && Request.Files.Count > 0)
    {
        HttpPostedFile uploadeFile = Request.Files[0];
        uploadeFile.SaveAs(FolderToSave + System.IO.Path.GetFileName(uploadeFile.FileName));
        Response.Write("File " + uploadeFile.FileName + " is succesfully uploaded.");
        x = uploadeFile.FileName.ToString();
    }
    else Response.Write("You have not selected any file!");

}