How verify type or extension of file using ASPUPLOAD?

  • Thread starter Vilmar Brazão de Oliveira
  • Start date
V

Vilmar Brazão de Oliveira

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
 
T

TomB

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.
 
V

Vilmar Brazão de Oliveira

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top