Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

Rammstein

Envio de Arquivo

Recommended Posts

Pessoal tenho esse endereço, vejam:

http://www.crpdesign.com.br/blog/upload_image.asp

 

Tipo, eu tento fazer o upload de arquivo jpg ou mesmo gif, mas ele fala q ñ eh um jpg, ou q ñ eh um gif.

Alçguém sabe me dizer o pq?

Podem viajar nos códigos lá, ñ eh dficil, eu arrumei muita coisa lah, mas esse dos arquivos ñ consigo mesmo.

 

 

Obrigado desde jah.

Compartilhar este post


Link para o post
Compartilhar em outros sites

axo q eh esse o código

 

vejam

<%Dim adoCon Dim strConDim strSQLDim rsconfigurationDim blnEmail ' verifica notifica emailDim intRecordsPerPage ' numero di record per paginaDim emailamministratore ' indirizzo email amministratoreDim blnCookieSet ' verifica funzione anti-spamDim Ublogtype ' tipologia di blog: "open" oppure "closed"Dim Ublogname ' titolo delle pagine che ospitano UblogDim StrPath  ' 'percorso fisico della cartella di upload immaginiDim StrPathShort ' percorso virtuale della cartella di upload immaginiDim kinkoffile ' tipo di file ammessi per l'uploadDim maxsizefile ' dimensione massima ammessa per le immagini uploadateDim PagesPerBlock ' numero di pagine da visualizzare i blocco'#######################################' INIZIO MODIFICA'#######################################'apertura connessione al dbSet adoCon = Server.CreateObject("ADODB.Connection")'strCon = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("mdb-database/blog.mdb")strCon = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=e:\home\crpdesign\web\blog\mdb-database\blog.mdb;"adoCon.Open strCon' definizione parametri upload immaginikinkoffile = "jpg,gif,bmp,png"maxsizefile = 50000 ' 50 kb'Per conoscere percorso fisico della cartella di upload basta' eseguire una pagina asp con il seguente codice: 'Response.Write "Path: " & Server.MapPath("/public/images_upload")StrPath = "web\blog\public\images_upload" StrPathShort = "web\blog\public\images_upload"PagesPerBlock = 10'#######################################' FINE MODIFICA'#######################################Set rsconfiguration = Server.CreateObject("ADODB.Recordset")strSQL = "SELECT configurazione.* FROM configurazione;"rsconfiguration.CursorType = 3rsconfiguration.Open strSQL, adoCon	If NOT rsconfiguration.EOF Then 	  Ublogname = rsconfiguration("nomeblog")	  emailamministratore = rsconfiguration("email_address")	  blnEmail = CBool(rsconfiguration("email_notify"))	  intRecordsPerPage = CInt(rsconfiguration("n_record"))	  blnCookieSet = CBool(rsconfiguration("cookie"))	  Ublogtype = rsconfiguration("tipologia")End ifrsconfiguration.CloseSet rsconfiguration = NothingFunction Anteprima(sText, nParole)  Dim nTemp, nVolte  'Eliminiamo gli eventuiali caratteri di CR ed LF  sText = Replace(sText, vbCrLf, "")  'Cerca la fine della prima parola  nTemp = InStr(sText, " ")  If nTemp <> 0 Then	 nVolte = 1	 'Finche` non abbiamo finito le parole o abbiamo 	 'raggiunto quelle massime	 While nTemp <> 0 And nVolte < nParole 		'Incrementiamo il numero delle parole trovate		 nVolte = nVolte + 1		'Cerchiamo la fine della parola successiva		 nTemp = InStr(nTemp + 1, sText, " ")	 Wend  End If  'Se abbiamo trovato qualche parola  If nVolte > 0 Then	 'Se La variabile nTemp > 0 allora significa che 	 'abbiamo trovato le n parole che ci serivivano	 If nTemp > 0 Then		'Le stampiamo insieme ai puntini		 Anteprima = Mid(sText, 1, nTemp - 1) & " ..."	 Else		'Altrimenti abbiamo trovato meno delle n 		'parole. Stampiamo la frase intera		 Anteprima = sText	 End If  Else	 ' una sola parola	 If Len(sText) > 0 Then		 Anteprima = sText	 Else		 'La frase passata ha lunghezza 0		 Anteprima = "" 	 End If  End IfEnd FunctionDim Ubloglanguage Ubloglanguage = Session("language") Select Case Ubloglanguage   Case "italian" %> <!--#include file="../language/language_italian.asp" --> <%   Case Else' default language %> <!--#include file="../language/language_english.asp" --> <% End Select %>

* Por favor utilize a TAG

 (botão  do editor) quando for postar códigos, isso formata e facilita a leitura de seu código.

Compartilhar este post


Link para o post
Compartilhar em outros sites

amigos tem isso aqui tbm....

eh um image size, mas axo q ñ tme nd haver

 

<%'******************************************************************' Classe ImageSize'   Data una immagine restituisce le dimensioni X,Y e numero di'   colori''   Proprietà:'	 ImageFile = path fisico completo dell'immagine'	 ImageName = restituisce il nome del file'	 ImageType = restituisce il tipo di immagine'	 ImageWidth = restituisce la larghezza in pixel dell'immagine'	 ImageHeight = restituisce l'altezza in pixel dell'immagine'	 ImageDepth = restituisce il numero di colori dell'immagine'	 IsImage = restituisce TRUE se il file è una immagine'' Author:' 2002 Luciani Massimiliano' [url="http://www.byluciani.com"]http://www.byluciani.com[/url]' webmaster@byluciani.com'' Original code:' [url="http://www.4guysfromrolla.com/webtech/011201-1.shtml"]http://www.4guysfromrolla.com/webtech/011201-1.shtml[/url]' Author: Mike Shaffer - mshaffer@nkn.net'' This script is FREEWARE'******************************************************************Class ImageSize  Public Dimensioni(2)  Public bolIsImage, strPathFile, strImageType    Private Sub Class_Initialize()  End Sub    Private Sub Class_Terminate()  End Sub  Public Property Get ImageName	  ImageName = doName(ImageFile)  End Property    Public Property Get ImageFile	  ImageFile = strPathFile  End Property    Public Property Let ImageFile(strImageFile)	  strPathFile = strImageFile	  gfxSpex(strPathFile)  End Property    Public Property Get ImageWidth	  ImageWidth = Dimensioni(1)  End Property    Public Property Get ImageHeight	  ImageHeight = Dimensioni(0)  End Property    Public Property Get ImageDepth	  ImageDepth = Dimensioni(2)  End Property     Public Property Get ImageType	  ImageType = strImageType  End Property	      Public Property Get IsImage	  IsImage = bolIsImage  End Property	   Public Function GetBytes(flnm, offset, bytes)	Dim objFSO	Dim objFTemp	Dim objTextStream	Dim lngSize		on error resume next		Set objFSO = CreateObject("Scripting.FileSystemObject")		' First, we get the filesize	Set objFTemp = objFSO.GetFile(flnm)	lngSize = objFTemp.Size	set objFTemp = nothing		fsoForReading = 1	Set objTextStream = objFSO.OpenTextFile(flnm, fsoForReading)		if offset > 0 then	  strBuff = objTextStream.Read(offset - 1)	end if		if bytes = -1 then		' Get All!		  GetBytes = objTextStream.Read(lngSize)  'ReadAll		else		  GetBytes = objTextStream.Read(bytes)		end if		objTextStream.Close	set objTextStream = nothing	set objFSO = nothing  end function  Public function lngConvert(strTemp)	lngConvert = clng(asc(left(strTemp, 1)) + ((asc(right(strTemp, 1)) * 256)))  end function  Public function lngConvert2(strTemp)	lngConvert2 = clng(asc(right(strTemp, 1)) + ((asc(left(strTemp, 1)) * 256)))  end function    Public Sub gfxSpex(flnm)	 dim strPNG 	 dim strGIF	 dim strBMP	 dim strType	 strType = ""	 strImageType = "(unknown)"	 bolIsImage = False	 strPNG = chr(137) & chr(80) & chr(78)	 strGIF = "GIF"	 strBMP = chr(66) & chr(77)	 strType = GetBytes(flnm, 0, 3)	 if strType = strGIF then				' is GIF		strImageType = "GIF"		lngWidth = lngConvert(GetBytes(flnm, 7, 2))		lngHeight = lngConvert(GetBytes(flnm, 9, 2))		lngDepth = 2 ^ ((asc(GetBytes(flnm, 11, 1)) and 7) + 1)		bolIsImage = True	 elseif left(strType, 2) = strBMP then		' is BMP		strImageType = "BMP"		lngWidth = lngConvert(GetBytes(flnm, 19, 2))		lngHeight = lngConvert(GetBytes(flnm, 23, 2))		lngDepth = 2 ^ (asc(GetBytes(flnm, 29, 1)))		bolIsImage = True	 elseif strType = strPNG then			' Is PNG		strImageType = "PNG"		lngWidth = lngConvert2(GetBytes(flnm, 19, 2))		lngHeight = lngConvert2(GetBytes(flnm, 23, 2))		lngDepth = getBytes(flnm, 25, 2)		select case asc(right(lngDepth,1))		   case 0			  lngDepth = 2 ^ (asc(left(lngDepth, 1)))			  bolIsImage = True		   case 2			  lngDepth = 2 ^ (asc(left(lngDepth, 1)) * 3)			  bolIsImage = True		   case 3			  lngDepth = 2 ^ (asc(left(lngDepth, 1)))  '8			  bolIsImage = True		   case 4			  lngDepth = 2 ^ (asc(left(lngDepth, 1)) * 2)			  bolIsImage = True		   case 6			  lngDepth = 2 ^ (asc(left(lngDepth, 1)) * 4)			  bolIsImage = True		   case else			  lngDepth = -1		end select 	 else 		strBuff = GetBytes(flnm, 0, -1)		' Get all bytes from file		lngSize = len(strBuff)		flgFound = 0		strTarget = chr(255) & chr(216) & chr(255)		flgFound = instr(strBuff, strTarget)		if flgFound = 0 then		   exit sub		end if 		strImageType = "JPG"		lngPos = flgFound + 2		ExitLoop = false 		do while ExitLoop = False and lngPos < lngSize 		   do while asc(mid(strBuff, lngPos, 1)) = 255 and lngPos < lngSize			  lngPos = lngPos + 1		   loop 		   if asc(mid(strBuff, lngPos, 1)) < 192 or asc(mid(strBuff, lngPos, 1)) > 195 then			  lngMarkerSize = lngConvert2(mid(strBuff, lngPos + 1, 2))			  lngPos = lngPos + lngMarkerSize  + 1		   else			  ExitLoop = True		   end if 	   loop 	   if ExitLoop = False then 		  lngWidth = -1		  lngHeight = -1		  lngDepth = -1 	   else 		  lngHeight = lngConvert2(mid(strBuff, lngPos + 4, 2))		  lngWidth = lngConvert2(mid(strBuff, lngPos + 6, 2))		  lngDepth = 2 ^ (asc(mid(strBuff, lngPos + 8, 1)) * 8)		  bolIsImage = True 	   end if				   	 end if	 Dimensioni(0) = lngHeight	 Dimensioni(1) = lngWidth	 Dimensioni(2) = lngDepth  end Sub    Public Function doName(strPath)	Dim arrSplit	arrSplit = Split(strPath, "\")	doName = arrSplit(UBound(arrSplit))  End Function  End ClassFunction IsImage(strImageName)  Set objImageSize = New ImageSize  With objImageSize	.ImageFile = Server.MapPath(strImageName)	If .IsImage Then	  IsImage = True	Else	  IsImage = False	End If    End With  Set objImageSize = NothingEnd Function%>

 

* Por favor utilize a TAG

 (botão  do editor) quando for postar códigos, isso formata e facilita a leitura de seu código.

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.