Some fixes in upload

main
Inga 🏳‍🌈 15 years ago
parent 20c5fb0be2
commit 51127b659c
  1. 2
      Builder/IISMainHandler/build.txt
  2. 2
      Builder/IISUploadHandler/build.txt
  3. 1
      IISMainHandler/handlers/request/UploadHandler.cs
  4. 13
      IISMainHandler/handlers/response/UploadListHandler.cs

@ -23,6 +23,7 @@ namespace FLocal.IISHandler.handlers.request {
protected override XElement[] Do(WebContext context) { protected override XElement[] Do(WebContext context) {
HttpPostedFile file = context.httprequest.Files["uploaded"]; HttpPostedFile file = context.httprequest.Files["uploaded"];
if(file == null) throw new FLocalException("file not uploaded"); 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); Upload upload = UploadManager.UploadFile(file.InputStream, System.IO.Path.GetFileName(file.FileName), DateTime.Now, context.session.account.user, null);
return new XElement[] { return new XElement[] {
new XElement("uploadedId", upload.id) new XElement("uploadedId", upload.id)

@ -24,12 +24,15 @@ namespace FLocal.IISHandler.handlers.response {
List<Upload> uploads = Upload.LoadByIds( List<Upload> uploads = Upload.LoadByIds(
from stringId in Config.instance.mainConnection.LoadIdsByConditions( from stringId in Config.instance.mainConnection.LoadIdsByConditions(
Upload.TableSpec.instance, Upload.TableSpec.instance,
new MultiValueCondition( new EmptyCondition(),
Upload.TableSpec.instance.getColumnSpec(Upload.TableSpec.FIELD_EXTENSION),
new string[] { "jpg", "gif", "png" }
),
pageOuter, pageOuter,
new JoinSpec[0] new JoinSpec[0],
new SortSpec[] {
new SortSpec(
Upload.TableSpec.instance.getColumnSpec(Upload.TableSpec.FIELD_UPLOADDATE),
true
)
}
) select int.Parse(stringId) ) select int.Parse(stringId)
); );
return new XElement[] { return new XElement[] {

Loading…
Cancel
Save