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

    Conversione script da win2000 a win2k3 percorso di upload

    Premetto che non conosco la sintassi dell'asp (php rulez ) ma mi trovo a dover fare i cazzotti con un applicazione web creata per win2000 da far girare per win2k3

    Mi sono così documentato sulle differenze di sintassi che ci sono, e quelle di codice da me comprensibile le ho modificate e funzionano (in pratica solo i mappath e gli include) porzioni di codice più complicate sono a me sconosciute, vi chiedo una mano.

    In fase di inserimento (file inser.asp in allegato) mi viene questo errore:

    Server.MapPath() error 'ASP 0174 : 80004005'

    Invalid Path Character(s)

    /admin/CatalogManager/insert.asp, line 141

    An invalid '/' or '\' was found in the Path parameter for the MapPath method.



    la parte della linea 141 è questa.

    codice:
    .
    .
    .
    .
    'Create and Write to a File
          GP_curPath = Request.ServerVariables("PATH_INFO")
          GP_curPath = Trim(Mid(GP_curPath,1,InStrRev(GP_curPath,"/")) & UploadDirectory)
          if Mid(GP_curPath,Len(GP_curPath),1)  <> "/" then
            GP_curPath = GP_curPath & "/"
          end if 
          GP_CurFileName = UploadRequest.Item(GP_curKey).Item("FileName")
          GP_FullFileName = Trim(Server.mappath(GP_curPath))& "\" & GP_CurFileName
          'Check if the file alreadu exist
          GP_FileExist = false
          Set fso = CreateObject("Scripting.FileSystemObject")
          If (fso.FileExists(GP_FullFileName)) Then
            GP_FileExist = true
          End If      
    .
    .
    .
    .
    E' sicuramente da sistemare il percorso ma non so dove mettere le mani, potete aiutarmi?

    Molte Grazie.

    il file insert.asp nella sua completezza (per essere più chiari possibile) si può scaricare qui (zippato)
    file insert.asp

  2. #2
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,563
    Dove devi uploadare?
    In che cartella partendo dalla root?

    Roby

  3. #3
    Dacci un po' più informazioni. Dove devi salvare il file (in che cartella) la posizione dei vari file e directory!

    Scusa Roby non avevo visto la tua risposta!

  4. #4
    Scusate il ritardo della risposta:

    si in una cartella partendo dalla root
    /applications/CatalogManager/download

  5. #5
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,563
    Sostituirei tutto questo

    codice:
    'Create and Write to a File
          GP_curPath = Request.ServerVariables("PATH_INFO")
          GP_curPath =  Trim(Mid(GP_curPath,1,InStrRev(GP_curPat
    h,"/")) & UploadDirectory)
          if Mid(GP_curPath,Len(GP_curPath),1)  <> "/" then
            GP_curPath = GP_curPath & "/"
          end if 
          GP_CurFileName = UploadRequest.Item(GP_curKey).Item("FileName")
          GP_FullFileName = Trim(Server.mappath(GP_curPath))& "\" & GP_CurFileName
    con:

    codice:
    GP_FullFileName = "/applications/CatalogManager/download/"

  6. #6
    Riporto il codice corretto, ma continua darmi errori
    questo
    codice:
    if nameConflict = "error" and GP_FileExist then
    deve dare true perchè il messaggio di errore che mi si presenta è questo:

    An error has occured saving uploaded file!

    Filename: http://www.masterslab.com/applicatio...d/ZyWALL35.jpg
    Maybe the destination directory does not exist, or you don't have write permission.
    Please correct and try again


    mentre il percorso è corretto.


    codice:
     'GP_curPath = Request.ServerVariables("PATH_INFO")
          'GP_curPath = Trim(Mid(GP_curPath,1,InStrRev(GP_curPath,"/")) & UploadDirectory)
          'if Mid(GP_curPath,Len(GP_curPath),1)  <> "/" then
            'GP_curPath = GP_curPath & "/"
          'end if 
          'GP_CurFileName = UploadRequest.Item(GP_curKey).Item("FileName")
          'GP_FullFileName = Trim(Server.mappath(GP_curPath))& "\" & GP_CurFileName
    	  
    	  GP_curPath = "http://www.masterslab.com/applications/CatalogManager/image/"
    	  GP_FullFileName = "http://www.masterslab.com/applications/CatalogManager/image/"
    	  
          'Check if the file alreadu exist
          GP_FileExist = false
          Set fso = CreateObject("Scripting.FileSystemObject")
          If (fso.FileExists(GP_FullFileName)) Then
            GP_FileExist = true
          End If      
          if nameConflict = "error" and GP_FileExist then
            Response.Write "File already exists!
    
    "
            Response.Write "Please correct and try again"
    				GP_strm1.Close
    				GP_strm2.Close
    	  	  response.End
          end if
          if ((nameConflict = "over" or nameConflict = "uniq") and GP_FileExist) or (NOT GP_FileExist) then
            if nameConflict = "uniq" and GP_FileExist then
              Begin_Name_Num = 0
              while GP_FileExist    
                Begin_Name_Num = Begin_Name_Num + 1
                GP_FullFileName = Trim(Server.mappath(GP_curPath))& "\" & fso.GetBaseName(GP_CurFileName) & "_" & Begin_Name_Num & "." & fso.GetExtensionName(GP_CurFileName)
                GP_FileExist = fso.FileExists(GP_FullFileName)
              wend  
              UploadRequest.Item(GP_curKey).Item("FileName") = fso.GetBaseName(GP_CurFileName) & "_" & Begin_Name_Num & "." & fso.GetExtensionName(GP_CurFileName)
    					UploadRequest.Item(GP_curKey).Item("Value") = UploadRequest.Item(GP_curKey).Item("FileName")
            end if
            on error resume next
            GP_strm2.SaveToFile GP_FullFileName,2
            if err then
              Response.Write "An error has occured saving uploaded file!
    
    "
              Response.Write "Filename: " & Trim(GP_curPath) & UploadRequest.Item(GP_curKey).Item("FileName") & "
    "
              Response.Write "Maybe the destination directory does not exist, or you don't have write permission.
    "
              Response.Write "Please correct and try again"
        		  err.clear
      				GP_strm1.Close
      				GP_strm2.Close
      	  	  response.End
      	    end if
      			GP_strm1.Close
      			GP_strm2.Close
      			if storeType = "path" then
      				UploadRequest.Item(GP_curKey).Item("Value") = GP_curPath & UploadRequest.Item(GP_curKey).Item("Value")
      			end if
            on error goto 0
          end if
        end if
      next
    
    End Sub

  7. #7
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,563
    Ma questa:

    GP_FullFileName = "/applications/CatalogManager/download/"

    dov'è?

    Roby

  8. #8
    pardon, ho fatto il copia e incolla dell'ultima prova che avevo fatto.

    codice:
     GP_curPath = "http://www.masterslab.com/applications/CatalogManager/image/"
    GP_FullFileName = "http://www.masterslab.com/applications/CatalogManager/image/"
    sarebbe
    codice:
      GP_curPath = "/applications/CatalogManager/download"
      GP_FullFileName = "/applications/CatalogManager/download"
    ma non funziona il messaggio d'errore è sempre lo stesso.

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 © 2024 vBulletin Solutions, Inc. All rights reserved.