// Z reference
Using System. IO;
Using System. Data. SqlClient;
// Download
DataSet ds = j. GetDownDetails (downloadID );
String filename = "../Admin/download/" + ds. Tables [0]. Rows [0] [3]. ToString () + "";
FileInfo DownloadFile = new FileInfo (Server. MapPath (filename ));
Response. Clear ();
Response. ClearHeaders ();
Response. Buffer = false;
Response. ContentType = "application/octet-stream ";
Response. AppendHeader ("Content-Disposition", "attachment; filename =" + HttpUtility. UrlEncode (DownloadFile. Name, System. Text. Encoding. UTF8 ));
Response. appendheader ("Content-Length", downloadfile. length. tostring ());
Response. writefile (downloadfile. fullname );
Response. Flush ();
Response. End ();
// Upload
// Call
If (fileupload1.filename! = String. Empty)
{
Ig. imgurl = uploadimg (Out MSG, fileupload1); // uploaded file
}
Protected byte [] uploadimg (out string message, fileupload fucontrol)
{
Message = String. Empty;
Try
{
If (! FuControl. HasFile)
{
// File not included
}
String fileContentType = fuControl. PostedFile. ContentType;
If (! (FileContentType = "image/x-png" | fileContentType = "image/bmp" | fileContentType = "image/gif" | fileContentType = "image/pjpeg "| fileContentType =" image/jpeg "))
{
// The uploaded file is not of a known image type}
Return fuControl. FileBytes;
}
Catch (Exception exp)
{
}
}