How verify type or extension of file using ASPUPLOAD?

Discussion in 'ASP General' started by Vilmar Brazão de Oliveira, Jan 15, 2004.

  1. Hi,

    How verify type or extension of file using ASPUPLOAD?
    I check documentation, but I didn't find anything else yet.
    thanks,
    --

    ««««««««»»»»»»»»»»»»»»
    Vlmar Brazão de Oliveira
    Desenvolvimento Web
    HI-TEC
    Vilmar Brazão de Oliveira, Jan 15, 2004
    #1
    1. Advertising

  2. Vilmar Brazão de Oliveira

    TomB Guest

    http://www.aspupload.com/manual_simple.html
    says
    Upload.Files is a collection of UploadedFile objects which offer access to
    various properties and attributes of uploaded files, such as filename, path,
    size, hash value, etc. The UploadedFile object also offers many methods
    which enable you to manipulate uploaded files (copy, move, save to the
    database, delete, etc.) Individual items of the collection can be referenced
    via numeric or string indices, or iterated through via the For-Each
    statement.

    which links to
    http://www.aspupload.com/object_file.html
    that says
    FileName As String (Read-Only)
    Returns the saved file's name. It may be different from the original file
    name if unique file generation (the property Upload.OverwriteFiles) is in
    effect.
    Usage:

    Response.Write File.FileName

    So, if that returns a string, you can just check the characters after the
    last . for the extension.

    "Vilmar Brazão de Oliveira" <> wrote in message
    news:...
    > Hi,
    >
    > How verify type or extension of file using ASPUPLOAD?
    > I check documentation, but I didn't find anything else yet.
    > thanks,
    > --
    >
    > ««««««««»»»»»»»»»»»»»»
    > Vlmar Brazão de Oliveira
    > Desenvolvimento Web
    > HI-TEC
    >
    >
    TomB, Jan 15, 2004
    #2
    1. Advertising

  3. Hi everybody,
    I made something thus:

    For Each Arquivo in objUpload.Files
    Caminho_e_Arquivo = Arquivo.Path
    ExtensaoArquivo = InStr(Arquivo.FileName,".gif")
    Exit For
    Next

    If ExtensaoArquivo = 0 then '»»NÃO foi encontrado a extensão .gif
    Response.Write "<script language='JavaScript'>alert('Tipo inválido de
    arquivo.\nEnvie arquivo GIF'); "
    Response.Write "history.go(-1);</script>"
    Response.End()
    End If

    It was not exactly what I wanted, because I really want to check the kind of
    mime file:
    image/jpg, image/gif, application/msexcel, etc.... Because the user can
    change a file extension, but not the mime type!

    Anybody knows anything using aspupload or other component???

    Thanks,

    --

    ««««««««»»»»»»»»»»»»»»
    Vlmar Brazão de Oliveira
    Desenvolvimento Web
    HI-TEC

    "TomB" <> escreveu na mensagem
    news:...
    > http://www.aspupload.com/manual_simple.html
    > says
    > Upload.Files is a collection of UploadedFile objects which offer access to
    > various properties and attributes of uploaded files, such as filename,

    path,
    > size, hash value, etc. The UploadedFile object also offers many methods
    > which enable you to manipulate uploaded files (copy, move, save to the
    > database, delete, etc.) Individual items of the collection can be

    referenced
    > via numeric or string indices, or iterated through via the For-Each
    > statement.
    >
    > which links to
    > http://www.aspupload.com/object_file.html
    > that says
    > FileName As String (Read-Only)
    > Returns the saved file's name. It may be different from the original

    file
    > name if unique file generation (the property Upload.OverwriteFiles) is in
    > effect.
    > Usage:
    >
    > Response.Write File.FileName
    >
    > So, if that returns a string, you can just check the characters after the
    > last . for the extension.
    >
    > "Vilmar Brazão de Oliveira" <> wrote in message
    > news:...
    > > Hi,
    > >
    > > How verify type or extension of file using ASPUPLOAD?
    > > I check documentation, but I didn't find anything else yet.
    > > thanks,
    > > --
    > >
    > > ««««««««»»»»»»»»»»»»»»
    > > Vlmar Brazão de Oliveira
    > > Desenvolvimento Web
    > > HI-TEC
    > >
    > >

    >
    >
    Vilmar Brazão de Oliveira, Jan 15, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John Rebbeck

    Problem with Persits ASPUpload

    John Rebbeck, Jul 11, 2003, in forum: ASP General
    Replies:
    3
    Views:
    166
    John Rebbeck
    Jul 14, 2003
  2. Guest

    AspUpload Configuration

    Guest, Jul 28, 2003, in forum: ASP General
    Replies:
    0
    Views:
    114
    Guest
    Jul 28, 2003
  3. Guest

    anyone familiar with ASPUpload?

    Guest, Aug 14, 2003, in forum: ASP General
    Replies:
    0
    Views:
    130
    Guest
    Aug 14, 2003
  4. Lars

    CDONTS and ASPUpload

    Lars, Sep 14, 2003, in forum: ASP General
    Replies:
    1
    Views:
    115
    Curt_C [MVP]
    Sep 14, 2003
  5. Vilmar Brazão de Oliveira

    Renaming a file with aspupload or FSO?

    Vilmar Brazão de Oliveira, Jan 13, 2004, in forum: ASP General
    Replies:
    5
    Views:
    185
    Roland Hall
    Jan 14, 2004
Loading...

Share This Page