im just wondering, since just checking the ext of a certain file is not enough
how can i check the mime type of an uploaded file to check if the file really is an image?
Thanks in advance,
Ulthane
| SitePoint Sponsor |



im just wondering, since just checking the ext of a certain file is not enough
how can i check the mime type of an uploaded file to check if the file really is an image?
Thanks in advance,
Ulthane




perhaps check for image dimensions to see if it really is an image
http://forums.aspfree.com/code-bank-...ns-196351.html



tried to combine that code with the uploading form code i got atm but had no luck apperantly..keep getitng alot of different errors..




you'll have to be a bit more specific if there is any expectation for help.



i cannot really be more specific, i can just show u my current code and u'll help me combining the image deminsions check with it if u can
Those checks i got currently are just to limit the file size or checking for its ext, i need something more just to avoid pple from being able to upload fake files by just changing their ext from .txt to .jpg for example...Code:<!--#INCLUDE FILE="clsUpload.asp"--> <% Dim Upload Dim FileName Dim Folder Set Upload = New clsUpload FileName =LCase(Upload.Fields("File1").FileName) If Right (FileName,4) = ".jpg" or Right (FileName,4) = ".bmp" or Right (FileName,4) = ".png" or Right (FileName,4) = ".gif" or Right (FileName,5) = ".jpeg" Then If Upload("File1").Length < 512000 Then Folder = Server.MapPath("db") & "\" & ("Photos") & "\" FileName = Upload.UniqueName(Folder, FileName) Upload("File1").SaveAs Folder & FileName Set Upload = Nothing Response.Redirect ("gallery.html") end if end if %>
Thanks in advance,
Ulthane





This is the Lewis Moten uploader class you are using - yes? He mentions in his website a method to determine if the uploaded file is an image, and what type.
Just search (Ctrl-F) in his site for Read Image Dimensions. In fact, I'd recommend you check out some of the other code snippets he has there.![]()



heh, i belive i deleted that asp file when i saw that i didnt use it, because i thought i wouldn't need to check for file deminsions, now i see how needed it is
Thanks, working.
Bookmarks