Re: Adding files to uploaded list programmatically

  •  11-20-2009, 7:26 AM

    Re: Adding files to uploaded list programmatically

    To follow up:
     
    I have made a little hack by sending a stream to the Itemlist containing the id in my database table which refer to the file I want to show in the list. I am using this id when the user clicks the Remove button later, to be able to remove the selected file from database and hard drive.
     
    My next problem is that even when I send the correct file size, the filesize shown on the rendered page shows the filesize of the dummystream.
     
    Stream stream = File.Open(Server.MapPath("file.pdf"), FileMode.Open);
    byte
    [] strfilid = {1, 2};
    Stream dummystream = new MemoryStream(strfilid);
    cwuploader.Items.Add(
    stream.length, "filename.pdf", dummystream);
     
    The above example returns when rendered:
    filename.pdf (2Bytes)
View Complete Thread