You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
1.0 KiB
34 lines
1.0 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Xml.Linq;
|
|
using FLocal.Common.dataobjects;
|
|
using FLocal.Importer;
|
|
using System.Text.RegularExpressions;
|
|
using FLocal.Core;
|
|
using FLocal.Common;
|
|
using FLocal.Common.actions;
|
|
using System.Web;
|
|
|
|
namespace FLocal.IISHandler.handlers.request {
|
|
class UploadHandler : AbstractPostHandler {
|
|
|
|
protected override string templateName {
|
|
get {
|
|
return "result/Upload.xslt";
|
|
}
|
|
}
|
|
|
|
protected override XElement[] Do(WebContext context) {
|
|
HttpPostedFile file = context.httprequest.Files["file"];
|
|
if(file == null) throw new FLocalException("file not uploaded");
|
|
if(file.ContentLength != file.InputStream.Length) throw new FLocalException("file is not uploaded completely");
|
|
Upload upload = UploadManager.UploadFile(file.InputStream, System.IO.Path.GetFileName(file.FileName), DateTime.Now, context.session.account.user, null);
|
|
return new XElement[] {
|
|
new XElement("uploadedId", upload.id)
|
|
};
|
|
}
|
|
|
|
}
|
|
}
|
|
|