Add in Web.config:
<add name= "Httpuploadmodule" type= "Krystalware.SlickUpload.HttpUploadModule, krystalware.slickupload"/>
2, add a reference to the Krystalware.SlickUpload.DLL in the project.
3, put the control on the page: HtmlInputFile fileupload;
4, after the code is as follows:
Copy Code code as follows:
private void Redirecttonewupload ()
{
Response.Redirect ("photoinfo.aspx?uploadid=" Guid.NewGuid (). ToString () "&action=" Strviewtype "&id=" btsid);
}
private void Page_Load (object sender, System.EventArgs e)
{
...
Uploadedfilecollection parts = Httpuploadmodule.getuploadedfiles ();
if (request.querystring["uploadid"] = = null)
Redirecttonewupload ();
...
}
private void Btupload_click (object sender, System.EventArgs e)
{
Uploadedfilecollection parts = Httpuploadmodule.getuploadedfiles ();
String uppath = system.configuration.configurationsettings.appsettings["Uploadpath"];
Try
{
if (Parts!= null)
{
foreach (UploadedFile part in parts)
{
if (part. contentlength==0)
Return
if (File.exists (Uppath part). ClientName))
{
File.delete (Uppath part. ClientName);
}
Part. SaveAs (Uppath part. ClientName);
byte[] Filebytearray = new Byte[part. ContentLength]; Image file temporary storage byte array
FileStream fs = new FileStream (Uppath part. ClientName, FileMode.Open);
Fs. Read (Filebytearray,0,convert.toint32 (part. ContentLength));
Fs. Close ();
File.delete (Uppath part. ClientName);
Use Filebytearray to save the resulting data
}
Redirecttonewupload ();
}