From 51127b659c6c3a22530e07583e703f6bf34b011b Mon Sep 17 00:00:00 2001 From: inga-lovinde <52715130+inga-lovinde@users.noreply.github.com> Date: Wed, 23 Jun 2010 16:04:35 +0000 Subject: [PATCH] Some fixes in upload --- Builder/IISMainHandler/build.txt | 2 +- Builder/IISUploadHandler/build.txt | 2 +- IISMainHandler/handlers/request/UploadHandler.cs | 1 + .../handlers/response/UploadListHandler.cs | 13 ++++++++----- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/Builder/IISMainHandler/build.txt b/Builder/IISMainHandler/build.txt index 6eac4a6..8975db9 100644 --- a/Builder/IISMainHandler/build.txt +++ b/Builder/IISMainHandler/build.txt @@ -1 +1 @@ -292 \ No newline at end of file +293 \ No newline at end of file diff --git a/Builder/IISUploadHandler/build.txt b/Builder/IISUploadHandler/build.txt index cabf43b..410b14d 100644 --- a/Builder/IISUploadHandler/build.txt +++ b/Builder/IISUploadHandler/build.txt @@ -1 +1 @@ -24 \ No newline at end of file +25 \ No newline at end of file diff --git a/IISMainHandler/handlers/request/UploadHandler.cs b/IISMainHandler/handlers/request/UploadHandler.cs index 363025b..0dd7c9e 100644 --- a/IISMainHandler/handlers/request/UploadHandler.cs +++ b/IISMainHandler/handlers/request/UploadHandler.cs @@ -23,6 +23,7 @@ namespace FLocal.IISHandler.handlers.request { protected override XElement[] Do(WebContext context) { HttpPostedFile file = context.httprequest.Files["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); return new XElement[] { new XElement("uploadedId", upload.id) diff --git a/IISMainHandler/handlers/response/UploadListHandler.cs b/IISMainHandler/handlers/response/UploadListHandler.cs index 2876bdd..a868c13 100644 --- a/IISMainHandler/handlers/response/UploadListHandler.cs +++ b/IISMainHandler/handlers/response/UploadListHandler.cs @@ -24,12 +24,15 @@ namespace FLocal.IISHandler.handlers.response { List uploads = Upload.LoadByIds( from stringId in Config.instance.mainConnection.LoadIdsByConditions( Upload.TableSpec.instance, - new MultiValueCondition( - Upload.TableSpec.instance.getColumnSpec(Upload.TableSpec.FIELD_EXTENSION), - new string[] { "jpg", "gif", "png" } - ), + new EmptyCondition(), pageOuter, - new JoinSpec[0] + new JoinSpec[0], + new SortSpec[] { + new SortSpec( + Upload.TableSpec.instance.getColumnSpec(Upload.TableSpec.FIELD_UPLOADDATE), + true + ) + } ) select int.Parse(stringId) ); return new XElement[] {