Any way to get file type?

Last post 01-07-2012, 11:43 AM by jmdl1983. 3 replies.
Sort Posts: Previous Next
  •  12-19-2011, 10:40 AM 72203

    Any way to get file type?

    Is there any way to get filetype out of the uploaded file? I know I can extract from original filename (not from the temp directory as it has resx on the end), but sometimes the file is not the same type as it's ending, is there a way to detect this?


    Jerry

  •  12-20-2011, 6:27 AM 72370 in reply to 72203

    Re: Any way to get file type?

    Hi Jerry2,
     
    For now asp uploader doesn't have the function to get the upload file type. Sorry for your inconvenience.
     
    Regards,
     
    Ken 
  •  12-20-2011, 7:16 AM 72372 in reply to 72370

    Re: Any way to get file type?

    Thanx. You can consider it for some new release ;-)
  •  01-07-2012, 11:43 AM 72542 in reply to 72372

    Re: Any way to get file type?

    for i = 1 to len(mvcfile.filename)-1
     if mid(mvcfile.filename,len(mvcfile.filename)-i,1)="." then
      filetype = Right(mvcfile.filename,i)
      exit for
     end if
    next
     
    This is a simple way, if you run this loop with each uploaded file, it will start with the furthest right character and work backwards until it finds the "." in the name; and then take all characters to the right as the "file type".
View as RSS news feed in XML