Fileupload-gadget
Introduction
This is a gadget which hosts a Silverlight-application, with the purpose of uploading files to EPiServer.
Almost every day in the life of a developer the following happens- you’ve had a meeting/workshop with your client (of the suspicious kind), with offices in a shady back ally in a country nobody but a bunch of professors in geography have heard about,
So anyways, you have a need to store the documents from the meeting and other artifacts in a safe place (while you’re out partying), and what place is better than EPiServer?
Obviously you suspect the client’s wireless network to have sniffing mechanisms which will sniff out all your passwords on Google Docs and VPN probably won’t work. So you log in to Episerver, upload the files there. But there’s still the risk of password sniffers,sniffing out the cms password, but hey, we have to choose the lesser of two evils :-)
Anyways, initially I was thinking that an entry like this should be qualified for disqualification due to the fact that some part of it is made in Silverlight. But then contributions came and lo, they were all using some sort of external system.
Technical details and process
In the beginning just for prototyping, I tried SWFUpload, which didn’t work as intended with general asp.net mvc. I then turned to a Silverlight-based solution. But generally speaking the gadget is just a bunch of projects which others have made and glued together using HyperGLUE-technology (so advanced so complex, i won’t even tell you what it is!) into a gadget (and inspired by other gadgets)
These include
1. Silverlight Multi File Uploader (using WCF)
2. Folder Browser Property (Marcus Lindblom) - Meridium AB
As suggested in “Introduction to gadget development” the gadgets can be stored in the Modules but looking at other gadgets and seeing that the controller tries to look for the views in the root “Views” folder on the website. In order to make the folder browser work properly I had to use the same approach but I’m not too fond of it since can risk overwriting setting/files from other gadgets b: referring to javascript/aspx files in the gadget markup will be repeated many times over which might not be a good practice.
And initially I thought the gadget would be quite easy to create and even if the views are almost empty I tried a lot of things to make the different aspects of the gadget to work together.
Features
Some features
· Select and upload multiple files
· Automatically overwrite (I think) the files if they already exist
· WCF- even bigger config files
· Ability to configure a standard folder always set (might be handy)
· Support for VersioningFileSystem and Nativefilesystem
Screenshots
Download
Installation
If you prefer to install it manually:
1. build and copy the folders to the root level of the site.
2. add the following things to web config
inside this node :
“<episerver.shell> <modules autoDiscovery="Minimal">”
add
<add name="UploadGadget">
<assemblies>
<add assembly="MultiFileUploadGadget1" />
</assemblies>
</add>
inside this node:
<system.servicemodel><services>
add
<service behaviorConfiguration="UploadServiceBehavior" name="mpost.FileUploadServiceLibrary.UploadService">
<endpoint address="" binding="customBinding" bindingConfiguration="binaryBinding" contract="mpost.FileUploadServiceLibrary.IUploadService" >
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
inside this node:
<system.serviceModel><behaviors><serviceBehaviors>
add:
<behavior name="UploadServiceBehavior" >
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
inside this node:
<system.serviceModel><bindings><customBinding>
<binding name="binaryBinding" ">
<binaryMessageEncoding maxReadPoolSize="2147483647" maxSessionSize="2147483647" maxWritePoolSize="2147483647" />
<httpTransport maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" />
</binding>
Extra settings which might be required
also, if you do not have the handler for .svc files you might need to add something like (for IIS7.x) in <system.webserver><handlers>
<add name="svchandler" path="*.svc" verb="*" type="System.ServiceModel.Activation.HttpHandler, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" preCondition="integratedMode" />
small update: This should be added before other handlers have a chance to handle the extension.
and finally
serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
inside the <system.servicemodel> tag
I haven’t added this tag as part of the installation package since there isn’t any “key-attribute” to verify if the tag already exists so you need to add it manually in case it isn’t there.
You’ll have to google for the IIS6 settings.
Disclaimer
During development of this and testing some VersioningFIleSystem methods I managed to wreck the filesystem. I recommend NativeFilesystem for testing. And as mentioned, existing files will most likely be overwritten.
Comments