Menu

#1 File Upload without COM object

open
nobody
None
5
2003-06-18
2003-06-18
Carl
No

I found some code written by Lewis Moten
(http://www.lewismoten.com) in an article on Planet
Source Code
(http://www.pscode.com/vb/scripts/ShowCode.asp?
txtCodeId=7361&lngWId=4), "Upload Files without COM
v2".

Working with that code, I have updated the
ActionAttach subroutine in OpenWiki 0.78 rev 1.2
(ow/owattach.asp, line 115 or so) to use this COM-less
upload method.

To do this, I made the following changes:

1. Added an include statement for Lewis's clsUpload.asp.

2. Removed a typelib definition from the top of
clsUpload.asp, since it conflicted with some of the ado
constant declarations in ow/owado.asp.

3. Added three constants to owattach.asp for
the "missing" values caused by step (2). These should
probably be moved to owado.asp, but I wanted to
change as few files as possible.

4. Rewrote Sub ActionUpload to use clsUpload instead of
the ABCUpload component. This ended up as a mixture
of Lewis's sample code and the existing ActionUpload.
My implementation is kind of lame (for example, it will
accept files of any size for upload, though it doesn't
save ones that are larger than
OPENWIKI_MAXUPLOADSIZE), but it works for me.

To use this patch, follow these steps:

1. Take the file attached to this patch and place it in
your ow/ folder.

2. Create an "upload" folder at the same level as
the "ow" folder in your OpenWiki installation.

3. Obtain the zipfile from the Planet Source Code article
referenced above, and extract clsUpload.asp and
clsField.asp into it.

4. Remove the first six lines from clsUpload.asp:
<pre>
METADATA
TYPE="TypeLib"
NAME="Microsoft ActiveX Data Objects 2.5
Library"
UUID="{00000205-0000-0010-8000-
00AA006D2EA4}"
VERSION="2.5"
</pre>

5. Make sure you have configured OpenWiki for
attachments and made your upload directory writeable
by the anonymous web user.

6. Upload like crazy.

Hope this is helpful!

Comments welcome.

-Carl

Discussion

  • Carl

    Carl - 2003-06-18

    Logged In: YES
    user_id=804191

    Oops, forgot to attach file!

     
  • Carl

    Carl - 2003-06-18

    Modified owattach.asp

     
  • Nobody/Anonymous

    Logged In: NO

    Thanks for the acknowledgement Carl.

    Lewis Moten
    lewis@moten.com
    http://www.lewismoten.com
    ICQ: 364308

     
  • Carl

    Carl - 2003-07-10

    Lewis's ZIP file with the relevant additional asp code.

     
  • Carl

    Carl - 2003-07-10

    Logged In: YES
    user_id=804191

    Attaching Lewis's ZIP file for easier access.

    -C

     
  • Thomas Du.

    Thomas Du. - 2003-10-30

    Logged In: YES
    user_id=218100

    Great work, but I have the following problem: Uploading
    works, but only with MS Internet Explorer. Different
    versions of Mozilla and Opera produced an error (see below
    for the error with Opera (disguised as MSIE)).
    Line 480 in owdb.asp seems to be related to the meta-data
    that is sent with the attachment? But I am not a programmer,
    so I do not know what to do.
    Any ideas?
    Thanks, Thomas

    Error page that shows after selecting a file and clicking
    the upload-button (I changed the server name):

    The page cannot be displayed
    There is a problem with the page you are trying to reach and
    it cannot be displayed.

    Please try the following:
    Click the Refresh button, or try again later.

    Open the xxx.yyy.zzz.de home page, and then look for links
    to the information you want.
    HTTP 500.100 - Internal Server Error - ASP error
    Internet Information Services

    Technical Information (for support personnel)
    Error Type:
    Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
    [Microsoft][ODBC Microsoft Access Driver]Error in row
    /montez/ow/owdb.asp, line 480

    Browser Type:
    Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0) Opera
    7.20 [en]

    Page:
    POST 17006 bytes to /montez/ow.asp

    POST Data:
    error '80020009'

    Exception occurred.

    /iisHelp/common/500-100.asp, line 223

     
  • Thomas Du.

    Thomas Du. - 2003-10-30

    Logged In: YES
    user_id=218100

    Solved it. On the pscode.com-page mentioned in the original
    text by Carl (see above) I found some hints and fixes, two
    of which I used. One of them just added the line "Exit
    Property" somewhere around line 447 in clsUpload.asp, but I
    guess that is not related to my problem. The other fix seems
    more important and solved my problem:
    In clsField.asp I added the following two lines after line 200:
    Else ' Added for browsers that don't pass the path
    FileName = pstrPath ' (i.e. only file name is passed).
    Now Mozilla Firebird and Opera are able to upload as well,
    all seems fine.
    Thomas

     
  • Ildefonzo Arocha

    Logged In: YES
    user_id=883585

    Hi there,

    I am trying to get this running with OpenWiki 0.78 rev.1.2

    I did the following:

    - Downloaded the two files attached to this page
    UploadFilesWithoutCOM.zip and owattach.asp.
    - Copied owattach.asp to D:\OpenWiki\owbase\ow
    - Created the D:\OpenWiki\owbase\upload directory
    - Copied clsUpload.asp to D:\OpenWiki\owbase\upload
    - There is no clsField.asp in that zip file!!! I assumed it was
    merged into clsUpload.asp
    - What I dont know is where to put all the other stuff
    (default.asp, DataFile.asp, ToDatabase.asp, ToFileSystem.asp
    and upload.mdb), it doesnt mention anything about these files.
    - I configured openwiki for attachements.
    - The attachment link shows, I am able to select a file but
    when I say "Upload" I get the following error:

    Microsoft VBScript runtime (0x800A01F4)
    Variable is undefined: 'loField'
    /openwiki/upload/clsUpload.asp, line 163

    Please help :)
    Ildefonzo

     
  • Thomas Du.

    Thomas Du. - 2004-03-08

    Logged In: YES
    user_id=218100

    hi Ildefonzo,
    please read and follow carefully the original posting on
    (top of) this page! At the beginning of Carl's text you will
    find a link to pscode.com, go to that page (make sure you
    get the complete link) and download the zip-file from there.
    "clsField.asp" is in that file!
    Do not forget the fixes mentioned in my earlier posting (Oct
    2003, see below), otherwise it may not work with Mozilla etc.
    The whole thing works nicely for OpenWiki 0.78 rev.1.2 at
    our site.
    Cheers, Thomas

     
  • Ildefonzo Arocha

    Logged In: YES
    user_id=883585

    ok, I finally got this up and running. I was confused with so
    many files updated from different places. Also there are some
    files in the zip that are not used :P

    Now that I am able to upload files, I have another problem, on
    the main OpenWiki page you will see all attachments listed at
    the end of the same page , (with out having to click on the
    attachement link), I dont have this functionality, how do I
    add it ?

    I was quiet surprised that the uploaded files are stored on the
    database, my idea of using the upload was for the users to
    upload images (mainly screenshots) and then make references
    to them in wiki pages. You know anyway I could manage
    this ?

    Thanks for your help,
    Ildefonzo

     
  • Ildefonzo Arocha

    Logged In: YES
    user_id=883585

    Forget about the last post, I found out how to do this :P

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.