Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
493 views
in Technique[技术] by (71.8m points)

file upload - How to Install NeatUpload?

Salvete! Whilst searching for a quality, free asp.net/ajax upload control, I found NeatUpload. I cannot find an online demo for it, but the download package does come with a demo. I need some help installing it on my server (Windows Server 2008).

I followed the directions at http://mumblestiltskin.blogspot.com/2009/10/using-neatupload-simple-setup.html (they are basically the same as the directions in the manual.htm that comes with the NeatUpload binary package).

So far, I have

  • Successfully installed Brettle.Web.NeatUpload.dll to the GAC using gacutil.
  • Added the reference in my web.config (with version and guid)
  • copied the demo file and its code-behind to my web application (which is registered in iis7)

Now, when I browse to the page, I get an asp.net server error on

Line 35: protected MultiFile multiFile;
Line 36: protected MultiFile multiFile2;
Line 37: protected InputFile inputFile;

and

error CS0246: The type or namespace name 'MultiFile' could not be found (are you missing a using directive or an assembly reference?)
error CS0246: The type or namespace name 'MultiFile' could not be found (are you missing a using directive or an assembly reference?)
error CS0246: The type or namespace name 'InputFile' could not be found (are you missing a using directive or an assembly reference?)
error CS0246: The type or namespace name 'InputFile' could not be found (are you missing a using directive or an assembly reference?)
error CS0246: The type or namespace name 'ProgressBar' could not be found (are you missing a using directive or an assembly reference?)
error CS0246: The type or namespace name 'ProgressBar' could not be found (are you missing a using directive or an assembly reference?)

What do I do now? Do I need to copy another dll somewhere, or certain files? I can't figure it out from the documentation.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Figured it out! I am deploying the control to a sharepoint web application. (Below, consider SPVD as "Sharepoint Application's Virtual Directory".) If you are not deploying to a Sharepoint website, then you will use the root of your web application's virtual directory where I have used Sharepoint's instead. Here are the steps I followed to get the demo page to run on my server.

Firstly, configuration is different if you use a "web-application" instead of a "web-site". I won't go into the difference here. But in my example, I am configuring a simple "web-site". I had to:

  • Copy Brettle.Web.NeatUpload.dll into the GAC on the server (it seems that on Windows Server 2008, you don't have to use the gacutil - just copy the dll into %windir%assembly. Also note that you must do this on the server; it doesn't work right if you try to do it over a network share). If you don't do this, the NeatUpload Demo just won't do anything. You will have to restart the website in IIS after you do this.
  • Some of the guides say you need to update the web.config to display the appropriate version and guid, but I found that I didn't have to do that (you will see my web.config below) - UNLESS - you want to use neatupload's section configuration in web.config. So, it is better just to do it right, you know.
  • The guides also say to use the guid and version number in the aspx pages, like demo.aspx, So, replace this:

    <%@ Register TagPrefix="Upload" Namespace="Brettle.Web.NeatUpload" Assembly="Brettle.Web.NeatUpload" %>

    with this:

    <%@ Register TagPrefix="Upload" Namespace="Brettle.Web.NeatUpload" Assembly="Brettle.Web.NeatUpload, Version=1.3.3798.663,Culture=neutral, PublicKeyToken=c95290d92c5893c8" %>

  • Copy the entire directory at NeatUpload-1.3.25dotnetappin to SVPDin. It contains the following items:

    • Brettle.Web.NeatUpload.dll (the same as the one you installed to the GAC)
    • Brettle.Web.NeatUpload.GreyBoxProgressBar.dll
    • Brettle.Web.NeatUpload.HashedInputFile.dll
    • Hitone.Web.SqlServerUploader.dll
    • a directory called en-US (with a dll in it)
    • another direcotry called fr (with a dll in it)
    • several .mdb databases, and Brettle.Web.NeatUpload.xml
    • Add the references to the http modules to the web-application's web.config file (see web.config sample below).
  • Now, you need to copy the directory: NeatUpload-1.3.25dotnetappNeatUpload to SPVD, and leave it named NeatUpload, so that you have SVPDNeatUpload with all its original contents. Now, in that folder, there are two files you need to edit: Progress.aspx and SmoothProgress.aspx. In the guides, I was told to use the guids and version numbers in the @ declarations, such as this:

    <%@ Page language="c#" AutoEventWireup="false" Inherits="Brettle.Web.NeatUpload.ProgressPage,Brettle.Web.NeatUpload,Version=1.3.3519.18793,Culture=neutral,PublicKeyToken=C95290D92C5893C8" %>

    <%@ Register TagPrefix="Upload" Namespace="Brettle.Web.NeatUpload" Assembly="Brettle.Web.NeatUpload, Version=1.3.3798.663,Culture=neutral, PublicKeyToken=c95290d92c5893c8" %>

Here is the web.config I put in the folder with the demo page.

<?xml version="1.0"?>
<configuration>

  <configSections>
    <!--You need this part so that you can have a neatupload configuration section.  You will get .net errors if you try to add the configuration section without this part here.-->
    <section name="neatUpload"
      type="Brettle.Web.NeatUpload.ConfigSectionHandler, Brettle.Web.NeatUpload"
      allowLocation="true"
      />
  </configSections>

  <!--This is where you put your neatupload configuration preferences.-->
  <neatUpload xmlns="http://www.brettle.com/neatupload/config/2008"
      useHttpModule="true"
    />

  <system.web>
    <customErrors mode="Off"/>
    <!-- Always required to use any of NeatUpload's features.  Without it, ProgressBars won't display and MultiFile will look like a regular HtmlInputFile. -->
    <httpModules>
      <add name="UploadHttpModule" type="Brettle.Web.NeatUpload.UploadHttpModule,Brettle.Web.NeatUpload,Version=1.3.3798.663,Culture=neutral,PublicKeyToken=c95290d92c5893c8" />
    </httpModules>

    <!-- Set these next 2 attributes large enough to accomodate the largest and longest running upload you want to support.  Note that browsers and IIS typically don't support uploads larger than 2GB (2097151 KB). -->
    <httpRuntime maxRequestLength="2097151" executionTimeout="999999"/>

    <!-- Not required for NeatUpload but makes it easier to debug in VS. -->
    <compilation debug="true"/>
  </system.web>

  <!-- For IIS7's Integrated Pipeline Mode which is used by the DefaultAppPool. -->
  <system.webServer>
    <security>
      <requestFiltering>
        <!-- Increased maxAllowedContentLength from default of 300MB. -->
        <requestLimits maxAllowedContentLength="2147483648" />
      </requestFiltering>
    </security>
    <modules>
      <add name="UploadHttpModule" type="Brettle.Web.NeatUpload.UploadHttpModule,Brettle.Web.NeatUpload,Version=1.3.3798.663,Culture=neutral,PublicKeyToken=c95290d92c5893c8" preCondition="managedHandler"/>
    </modules>
    <validation validateIntegratedModeConfiguration="false"/>
  </system.webServer>
</configuration>

Some Notes on Installation Packages The installation package I used was at http://neatupload.codeplex.com/releases/view/46086 - there seem to be a few others, such as a "binaries package" at http://neatupload.codeplex.com/releases/view/59339, but the directory structure is different, and the instructions won't make much sense. There is also a package on the main project page at CodePlex: http://neatupload.codeplex.com/, but if you use this package, you will have a different version number and guid for the dll when you deploy it to the GAC.

Instruction Manuals By way of an instruction manual, check out: http://mumblestiltskin.blogspot.com/2009/10/using-neatupload-simple-setup.html?showComment=1335835416022#c1846924755786832325, and there is also an html manual in the binaries package above. In the other packages, you have to "build" the manual with Open Office. Then, of course, you can reference this post!

Troubleshooting Having problems?

The only thing left now, is to add some sort of handler for copying the files to where you want them. NeatUpload only adds them to a temp file, and I have yet to figure out where it is...


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...