Visualizzazione dei risultati da 1 a 2 su 2
  1. #1

    Problema con upload immagini con AspJpeg

    Ciao a tutti,
    ho un grosso problema con l'upload di foto con AspJpeg.
    Se carico 3 foto ad alta qualità non ho nessun problema. Se provo a caricare 4 o 5 foto non carica nulla perchè questa procedura:

    codice:
    Function UpLoad()
    
    	Dim bytArray
    	Dim bytecount 		
    	
    	bytecount = Request.TotalBytes
    	if bytecount = 0 then
    		UpLoad = 0
    		exit function
    	end if
    	
    	' continue only when bytecount>0
    	
    	Set inputs = Server.CreateObject("Scripting.Dictionary")
    	bytArray = Request.BinaryRead(bytecount)
    		
    	Dim objInput
    	
      Dim adLongVarChar
      adLongVarChar = 201     
        
      Dim strByteToString
      Dim lngLoop	
      
      Dim strIDInput   
      Dim lngStartPos
      Dim lngFieldStartPos 
      
      Dim strInputHeader 
      Dim strContetType 
      Dim strInputName 
      Dim strFileName 
      Dim strFilePath 
      Dim strInputContent 
      Dim isFile
      
      Dim rstTemp
      
      ' we using anrecordset object to quickly convert array of byte to string
      Set rstTemp = Server.CreateObject("ADODB.Recordset")
      rstTemp.Fields.Append "bytArray", adLongVarChar, lenb(bytArray)
      rstTemp.Open 
      rstTemp.AddNew  
      rstTemp.Fields("bytArray").AppendChunk bytArray
      rstTemp.Update
      
      ' we have getted the original string
      strByteToString = rstTemp("bytArray")
      Set rstTemp=Nothing
      
      lngStartPos = 1
      
      ' get row separation
      strIDInput = Mid(strByteToString, 1, InStr(1, strByteToString, vbCrLf) - 1)
      
      ' for each input field
      While lngStartPos > 0
        ' resets all input variables
        strInputHeader = ""
        strContetType = ""
        strInputContent = ""
        strInputName = ""
        strFileName = ""
        strFilePath = ""
    		isFile = false
    		
        ' skip row separation
        lngStartPos = lngStartPos + Len(strIDInput) + 2
        
        ' gets current input header
        strInputHeader = Mid(strByteToString, lngStartPos, InStr(lngStartPos, strByteToString, vbCrLf) + 2 - lngStartPos)
        ' skip input header
        lngStartPos = lngStartPos + Len(strInputHeader)
         
        ' gets content type if any
        strContetType = Mid(strByteToString, lngStartPos, InStr(lngStartPos, strByteToString, vbCrLf) + 2 - lngStartPos)
        ' skip content type
        lngStartPos = lngStartPos + Len(strContetType)
        If Len(strContetType) > 2 Then lngStartPos = lngStartPos + 2
        
        ' gets content input value
        strInputContent = Mid(strByteToString, lngStartPos, InStr(lngStartPos, strByteToString, strIDInput) - 2 - lngStartPos)
        ' skip content type
        lngStartPos = lngStartPos + Len(strInputContent) + 2
        
        ' gets input header fields
        '   gets "name" field
        lngFieldStartPos = InStr(1, strInputHeader, "; name=", vbTextCompare) + 8
        strInputName = Mid(strInputHeader, lngFieldStartPos, InStr(lngFieldStartPos, strInputHeader, Chr(34)) - lngFieldStartPos)
        lngFieldStartPos = 0
        
        '   gets "filename" field if exists
        lngFieldStartPos = InStr(1, strInputHeader, "; filename=", vbTextCompare)
        If lngFieldStartPos > 0 Then
          lngFieldStartPos = lngFieldStartPos + 12
          strFilePath = Mid(strInputHeader, lngFieldStartPos, InStr(lngFieldStartPos, strInputHeader, Chr(34)) - lngFieldStartPos)
          if len(strFilePath)>0 then
    				strFileName = Mid(strFilePath, InStrRev(strFilePath, "\", Len(strFilePath)) + 1)
    				strFilePath = Mid(strFilePath, 1, InStrRev(strFilePath, strFileName, Len(strFilePath)) - 1)
    			end if
        End If
        lngFieldStartPos = 0
        
        '***********************************
        ' from this point we have all data            
        
        If strFileName <> "" Then
    			isFile = True
    		else
    			isFile = False
    		end if
    	
    		' create the input object with current values
    		Set objInput = new clsInput
    		objInput.name = strInputName		
    		objInput.isFile = isFile
    		objInput.content = strInputContent
    		objInput.size = len(strInputContent)
    		objInput.fileName = strFileName
    		objInput.filePath = strFilePath
    		
    		' append just created input object to "inputs" collection
    		Set inputs(strInputName) = objInput
    		
    		Set objInput = Nothing
    		
        '***********************************
        
        ' go to next input value
        lngStartPos = InStr(lngStartPos, strByteToString, strIDInput)
        ' check if input separator is the last
        If Mid(strByteToString, lngStartPos + Len(strIDInput) + 1, 1) = "-" Then lngStartPos = 0
      Wend
      
      bytArray = ""
      UpLoad = bytecount
        
    End Function
    restituisce un valor nullo.

    Se carico 5 foto con bassa risoluzione non ho nessun problema.
    Capit bene che non posso dire ai clienti di salvare le foto con una risoluzione bassa.
    Come risolvo questo problema?
    Grazie mille

  2. #2
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,559
    Se non è un problema di timeout forse non ti rimane che far caricare un po' di foto alla volta.

    Roby

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.