DNNDev Admin
 Senior Member Posts:6419

 |
| 21 Jun 2005 06:33 PM |
|
Sorry for the delay in posting this. I'm deeply engaged in trying to get a new feature version of XMod ready for release. Attached to this post you'll find the source code to XMod's FileUpload custom form control. It is a server control, written in VB.NET. I'm providing this source code for a few reasons: 1) So that you'll have an example of how to build a custom form control for XMod. Using this source as an example, I hope to spur the development of additional controls - free or for sale. 2) So you can tweak and make changes to the FileUpload control for your own projects. 3) So you'll contribute your feature additions, tweaks, and bug fixes back to me so I can incorporate those changes back into XMod, allowing all XMod users to benefit from your work and for you to benefit from the work of others. In the attached Zip file, you'll find FileUpload.vb. You'll need to create a DLL project and a reference to KnowBetter.XMod.dll and DotNetNuke.dll. This code is for the DNN3 version of the FileUpload control. If you have questions and comments, you can post to this thread. Cheers, Kelly |
Attachment: 1621334512571.zip
|
Power Your Website With XMod Pro Buy XMod Pro Today |
|
|
Tony Harrison
 Advanced Member Posts:851

 |
| 02 May 2006 04:54 PM |
|
Hi Kelly, Is this source code still valid for use with the latest release of XMOD (4.06). I am trying to add some new features to the fileupload control, I have created a new project in VS 2003 and added references to Dotnetnuke and KnowBetter.XMod, pasted in your code but I get the following kind of warnings: D:\profiles\HarrisonA1\My Documents\Visual Studio Projects\XMOD FileUpload\FileUpload\FileUpload.vb(31): 'FileUpload.FileUpload' must implement 'Overridable Property SelectedItems() As System.Collections.ArrayList' for interface 'KnowBetter.XMod.Extensibility.IFormControl'. Implementing property must have matching 'ReadOnly'/'WriteOnly' specifiers. see screenshot attached. Can you help please? |
Attachment: 152541810971.jpg
|
we don't make XMod, we make it better! |
|
|
DNNDev Admin
 Senior Member Posts:6419

 |
| 02 May 2006 05:03 PM |
|
This means that while you have declared you're implementing the IFormControl interface, you haven't implemented the SelectedItems portion of this. Typically, all you need to do is place your cursor at the end of the "Implements KnowBetter.XMod.Extensibility.IFormControl" line and hit enter. VS will add the declarations for the missing interface parts at the end of your code. The SelectedItems() part is especially important as it allows XMod to tell your control what items the user selected previously (if the record is being edited) and allows your control to tell XMod what items should be saved. Best, Kelly |
|
Power Your Website With XMod Pro Buy XMod Pro Today |
|
|
Tony Harrison
 Advanced Member Posts:851

 |
| 22 May 2006 01:23 PM |
|
Thanks for your help. I have added some new functionality and recompiled the code to fatgeorge.FileUpload.dll and copied this file to the dotnetnuke/bin folder on my local instance of DNN. I have copied an existing form which used your fileupload and replaced the register statement to reference mine. Screen full of errors when I try to display. What else should I do to enable me to use my new control? Cheers |
|
we don't make XMod, we make it better! |
|
|
Tony Harrison
 Advanced Member Posts:851

 |
|
ricky venus
 New Member Posts:5

 |
| 29 May 2006 03:22 AM |
|
If anyone develops a FileUpload control that does image resizing (ie thumbnails) then I'd be willing to pay for it. I'm not enough of a programmer to figure out how to do it. |
|
|
|
|
Tony Harrison
 Advanced Member Posts:851

 |
|
Tony Harrison
 Advanced Member Posts:851

 |
| 31 May 2006 04:38 PM |
|
Just out of interest how much would you pay for an extended fileupload control with the ability to create thumbnails (which maintain aspect ratio)? |
|
we don't make XMod, we make it better! |
|
|
ricky venus
 New Member Posts:5

 |
| 01 Jun 2006 07:46 AM |
|
For now I've found a dirty way of doing the resize on the fly. I think actully having thumbnails created as the file uploads would enhance server performance time on viewing. If you can do that, as well as place them in a different directory (possibly with another tag for templates to specify whether u want the original or thumb) that would be cool. In all my searching I found that there used to be a mod to this called XFileUpload that someone was selling for $5 on snowcovered. If you can get it working right and keep doing updates, I'm sure $10-15 would be fair, plus I've seen many others looking for the same thing so I'm sure you'd have a market. Unless you just want to contribute it free for the good of the community  |
|
|
|
|
Tony Harrison
 Advanced Member Posts:851

 |
| 01 Jun 2006 04:38 PM |
|
I have made a beta version of my extended fileupload custom control available at http://www.fatgeorge.co.uk in the downloads section. This is an extended version of the XMod fileupload custom control. New features include: Resize images, Generate image thumbnails, Watermark images, Diskquota, Maximum file size for upload. This is a beta version and has been developed and tested using DNN 3.2.2 and XMOD 4.3 This beta expires on 1st July 2006. I will setup a forum on my site to allow feedback, please let me know how you get on with it and also give me some ideas for improvements/new functionality. |
|
we don't make XMod, we make it better! |
|
|
The Manager
 Basic Member Posts:104

 |
| 07 Jun 2006 10:18 PM |
|
hi Fatgeorge, I am having problems downloading you beta from your site. I just end up with a file called fatgeorge with no extension and 0 size. Are there problems with the site? Antony |
|
|
|
|
Eric Maynard
 Basic Member Posts:192

 |
| 08 Jun 2006 02:15 AM |
|
He is having troubles with the files and the code as well, but I'm betting you are using FireFox right? It has trouble with files with spaces in the name and that particular file is "fatgeorge FileUpload" or something like that. Try it with IE once and you should get the extension, but its still a 0 byte file. Not much help, i know, but at least you know now its not only you. Good Luck fatgeorge  We're all eager to test your enhancements. -eric |
|
|
|
|
Tony Harrison
 Advanced Member Posts:851

 |
| 16 Jun 2006 12:37 PM |
|
beta 1.1 is now available for download with updated docs. Thanks to Scott for pointing out the problem with the size of the watermarked images, these now get compressed. please give it a try at http://www.fatgeorge.co.uk |
|
we don't make XMod, we make it better! |
|
|
Dave Sparks
 New Member Posts:11

 |
| 10 Jul 2006 04:58 PM |
|
I've got the original FileUpload to work in Medium Trust. I removed all use of FileInfo object for path manipulation and used System.IO.Path instead and manipulated the strings directly. It's a sloppy conversion, but it works. Feel free to observe the changes and optimize the code: http://www.sinewsofwar.com/zStuff/FileUpload.vb.txt Note: Remove the ".txt" extension if you download it... I just needed to add that to allow viewing or downloading from my site. |
|
|
|
|
DNNDev Admin
 Senior Member Posts:6419

 |
| 10 Jul 2006 05:21 PM |
|
CrashDome,
So, the FileInfo object was the root cause of the Medium Trust issue?
Thanks for the code. I'll take a look at it and get it incorporated into XMod.
Best, Kelly
|
|
Power Your Website With XMod Pro Buy XMod Pro Today |
|
|
Tony Harrison
 Advanced Member Posts:851

 |
| 10 Jul 2006 05:27 PM |
|
I am interested in this issue as I need to use the fileinfo object to check filesize etc for quota management. Could you try installing my version of the upload control and let me know what happens. My hosting company apparently run a "custom trust mode". |
|
we don't make XMod, we make it better! |
|
|
Dave Sparks
 New Member Posts:11

 |
| 10 Jul 2006 07:20 PM |
|
My hosting company (AspNix.com) also runs a custom version of Medium Trust but it is a single change and I will check what specifically they changed. I will also gladly try out your control for you. Keep in mind I *believe* the FileInfo problem relates specifically to the clients file before uploading. In other words, you are attempting to access file information from the clients machine when all you really need is to manipulate the path to get the filename and extension. Using FileInfo for the file(s) located within the virtual directory *may be* ok. I wasn't sure when I started out on this so I went crazy and replaced all uses of FileInfo. However, I did run into a problem in BindControl() using FileInfo also... even though that should technically work (I think). [EDIT] @fatgeorge I just tried your control using the example you provide in the Word doc and it wouldn't even render. I get a permission error just from viewing the page. I tested taking out the <custom> block and the form showed up fine. The original FileUpload atleast rendered and functioned in Medium Trust but failed when uploading. You may want to take a look at your changes. |
|
|
|
|
Tony Harrison
 Advanced Member Posts:851

 |
| 10 Jul 2006 11:05 PM |
|
I can't understand why it wouldn't render, I understand you may have problems performing an upload. Have you tried the control on a local machine? Do you have a development environment that is local and not hosted? |
|
we don't make XMod, we make it better! |
|
|
Dave Sparks
 New Member Posts:11

 |
| 11 Jul 2006 02:55 PM |
|
Yes, I do.. but it is not Medium Trust. Here is the exception: AssemblyVersion: 04.00.02 Method: fatgeorge.FileUpload.FileUpload.InitFormControl FileName: FileLineNumber: 0 FileColumnNumber: 0 PortalID: 0 PortalName: XXXXXXXXXXXXXXXXXXXXXXXXX UserID: 1 UserName: host ActiveTabID: XXX ActiveTabName: Test XMod AbsoluteURL: /Default.aspx AbsoluteURLReferrer: ExceptionGUID: 5f2d3ab2-1c29-4505-88de-d26fdca7a67a DefaultDataProvider: DotNetNuke.Data.SqlDataProvider, DotNetNuke.SqlDataProvider InnerException: Unhandled Error: Message: System.Exception: Unhandled Error: ---> DotNetNuke.Services.Exceptions.PageLoadException: Operation could destabilize the runtime. ---> DotNetNuke.Services.Exceptions.ModuleLoadException: Operation could destabilize the runtime. ---> System.Security.VerificationException: Operation could destabilize the runtime. at fatgeorge.FileUpload.FileUpload.InitFormControl(Int32 XModId, PortalModuleBase pmc) at KnowBetter.XMod.XModFeedback.SendCustomFormControlEvent(CustomFormControlEvents evt, ArrayList alCustomControls) at KnowBetter.XMod.XModFeedback.Page_Load(Object sender, EventArgs e) --- End of inner exception stack trace --- at DotNetNuke.Services.Exceptions.Exceptions.ProcessModuleLoadException(String FriendlyMessage, PortalModuleBase ctrlModule, Exception exc, Boolean DisplayErrorMessage) at KnowBetter.XMod.XModFeedback.Page_Load(Object sender, EventArgs e) at System.Web.UI.Control.OnLoad(EventArgs e) at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) --- End of inner exception stack trace --- at DotNetNuke.Services.Exceptions.Exceptions.ProcessPageLoadException(Exception exc, String URL) at DotNetNuke.Framework.PageBase.Page_Error(Object Source, EventArgs e) at System.Web.UI.TemplateControl.OnError(EventArgs e) at System.Web.UI.Page.HandleError(Exception e) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest() at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) at System.Web.UI.Page.ProcessRequest(HttpContext context) at ASP.default_aspx.ProcessRequest(HttpContext context) at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) --- End of inner exception stack trace --- StackTrace: Source: [I guess it wasn't a "Permission error" I must have it burned into my eyes  ) |
|
|
|
|
Rob Eastham
 New Member Posts:19

 |
| 12 Jul 2006 12:03 AM |
|
Hi CrashDome Think I've run into the Medium trust problem associated with the fileupload control with a new shared host I'm migrating to. My coding and compilation skills are a little rusty these days - any chance you can post a link to a zipped up version of your modfied dll for the fileupload control? If so this would be very much appreciated. Kelly indicated to me via a support email that he intends to roll your changes into a future release of Xmod - but until then I'm a little bit stuck. Many thanks. Rob |
|
|
|
|
Dave Sparks
 New Member Posts:11

 |
| 12 Jul 2006 03:45 PM |
|
Sure, Rob. Here: http://www.sinewsofwar.com/zStuff/sow.fileupload.zip Note: I make no guarantees with this nor do I express any support on this, but you can use it as a temporary fix until an official version (of someone's) is released. The Assembly name and such is the same as the filename. So use: <register tagprefix="sowfu" namespace="sow.fileupload" assembly="sow.fileupload" /> You will have to change this again if you switch over to someone else's fileupload control. |
|
|
|
|
Tony Harrison
 Advanced Member Posts:851

 |
| 12 Jul 2006 04:49 PM |
|
The enhanced fatgeorge fileupload control has now been released! You can find it at Snowcovered. http://www.snowcovered.com/snowcovered2/Default.aspx?tabid=242&PackageID=5037 Note: This version does not include Crashdome's Medium Trust fix, once this has been validated I will release a patch. |
|
we don't make XMod, we make it better! |
|
|
DNNDev Admin
 Senior Member Posts:6419

 |
| 12 Jul 2006 05:04 PM |
|
Hi fatgeorge,
Congratulations on the new listing! Be sure to add your listing on our XMod Add-Ons page (available from the XMod nav menu).
FYI, you may want to change your listing's title a bit. "fatgeorge fileupload control for XMod 1.0" makes it sound like the upload control is for XMod version 1.0. It would be better to move the 1.0 to after "control".
Of course, if I can be of further help/assistance, feel free to contact me.
Best, Kelly
|
|
Power Your Website With XMod Pro Buy XMod Pro Today |
|
|
Rob Eastham
 New Member Posts:19

 |
| 12 Jul 2006 05:38 PM |
|
CrashDome thanks so much for your willingness to share the dll. Unfortuantely when I add it to my form template and then try to view the form page I get a A BadImageFormatException, which according to the MS website: BadImageFormatException exception is thrown when the file image of a DLL or executable program is not valid. I am running 3.2.2 on .NET 1.1 and v03.02.09 of XMod if this is relevant. The error displayed on screen is as follows: DotNetNuke.Services.Exceptions.ModuleLoadException: Unhandled Error Adding Module to ContentPane ---> System.Web.HttpParseException: Parser Error: ? ---> System.BadImageFormatException: ? File name: "sow.fileupload" at System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Boolean isStringized, Evidence assemblySecurity, Boolean throwOnFileNotFound, Assembly locationHint, StackCrawlMark& stackMark) at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Boolean stringized, Evidence assemblySecurity, StackCrawlMark& stackMark) at System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark) at System.Reflection.Assembly.Load(String assemblyString) at System.Web.UI.CompilationConfiguration.LoadAssembly(String assemblyName, Boolean throwOnFail) at System.Web.UI.TemplateParser.LoadAssembly(String assemblyName, Boolean throwOnFail) at System.Web.UI.TemplateControlParser.ProcessDirective(String directiveName, IDictionary directive) at System.Web.UI.TemplateParser.ParseStringInternal(String text) at System.Web.UI.TemplateParser.ParseString(String text, String virtualPath, String basePhysicalDir) --- End of inner exception stack trace --- at System.Web.UI.TemplateParser.ParseString(String text, String virtualPath, String basePhysicalDir) at System.Web.UI.TemplateParser.Parse() at System.Web.UI.TemplateParser.ParseTemplateInternal(String content, HttpContext context, String baseVirtualDir) at System.Web.UI.TemplateControl.ParseControl(String content) at KnowBetter.XMod.XModFormGenerator.CreateForm(Int32 FormId, EditModeEnum EditMode) at KnowBetter.XMod.XModFeedback.CreateForm() at KnowBetter.XMod.XModFeedback.Page_Init(Object sender, EventArgs e) at System.Web.UI.Control.OnInit(EventArgs e) at System.Web.UI.UserControl.OnInit(EventArgs e) at System.Web.UI.Control.InitRecursive(Control namingContainer) at System.Web.UI.Control.InitRecursive(Control namingContainer) at System.Web.UI.Control.InitRecursive(Control namingContainer) at System.Web.UI.Control.InitRecursive(Control namingContainer) at System.Web.UI.Control.AddedControl(Control control, Int32 index) at System.Web.UI.ControlCollection.Add(Control child) at DotNetNuke.UI.Skins.Skin.InjectModule(Control objPane, ModuleInfo objModule, PortalSettings PortalSettings) --- End of inner exception stack trace --- Any ideas? Many thanks. Rob |
|
|
|
|
Dave Sparks
 New Member Posts:11

 |
| 12 Jul 2006 07:12 PM |
|
Rob,
I am sorry. The dll was compiled on and runs on .Net 2.0 (DNN 4.0+). I am not sure if that should or should not make a difference. If it doesn't... I don't know what to say other than was it registered correctly within XMod?
@Kelly, Fatgeorge Please note that also. I am unsure of the difference between .Net 1.1 and .Net 2.0 when it comes to fixing anything. I migrated to .Net 2.0 when developing my own apps a long time ago and have since not looked back, so I don't even remember what is or is not capable in .Net 1.1 anymore. |
|
|
|
|