Pagina 1 di 2 1 2 ultimoultimo
Visualizzazione dei risultati da 1 a 10 su 20

Discussione: Variabile

  1. #1

    Variabile

    Buona sera a tutti!!

    Avrei un problemino... da esporvi...

    ho una pagina, default.asp, con un semplice form e dovrei passare una variabile "dir" nella pagina carica.asp (qua sotto ) ma quando richiamo quest'ultima pagina il sistema si "impalla" dove sbaglio?



    Codice PHP:
    <%@ Language=VBScript %>
    <% 
    option explicit 
    Response
    .Expires = -1
    Server
    .ScriptTimeout 600
    ' All communication must be in UTF-8, including the response back from the request
    Session.CodePage  = 65001


    %>

    <%


      ' 
    ****************************************************
      
    ' Change the value of the variable below to the pathname
      ' 
    of a directory with write permissions, for example "C:\Inetpub\wwwroot"
      ' ****************************************************

      Dim uploadsDirVar
      dim dir

    '
    uploadsDirVar "C:\Inetpub\wwwroot\PUBLIC\img\oooo\" 


    dir = request.Form("
    dir")
    uploadsDirVar = dir
    response.Write(uploadsDirVar)

    function OutputForm()



    %>
        <html xmlns="
    http://www.w3.org/1999/xhtml">
    <head>
        <
    meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <
    title>Uploadify Move the Queue Sample</title>
        <
    link rel="stylesheet" href="uploadify/uploadify.css" type="text/css" />
        <
    script type="text/javascript" src="js/jquery-1.3.2.min.js"></script>
        <script type="text/javascript" src="js/jquery.uploadify.js"></script>
        <script type="text/javascript">

    $(document).ready(function() {
        $("#fileUpload").fileUpload({
            'uploader': 'uploadify/uploader.swf',
            'cancelImg': 'uploadify/cancel.png',
            'script': 'carica.asp',
            'folder': 'uploads',
            'multi': true,
            'displayData': 'percentage',

    /*        onInit: function (){                        
                $(this).css('display','none');
                if ($.browser.msie) {
                    $(this).after('<div id="' + $(this).attr("id")  + 'Uploader"></div>');
                    document.getElementById($(this).attr("id")  + 'Uploader').outerHTML = flashElement;
                } else {
                    $(this).after(flashElement);
                }
                $("#customspot").after('<div id="' + $(this).attr('id') + 'Queue" class="fileUploadQueue"></div>');
                return false;
            }
    */    });
    });

    </script>
    </head>
    <body>
        <div style="float: left">
            <fieldset style="border: 1px solid #CDCDCD; padding: 8px; padding-bottom: 0px; margin: 8px 0; width: 450px">
                <legend>[b]Upload Files - movedQueue Sample[/b]</legend>
                <div id="fileUpload">
                    You have a problem with your javascript</div>
                [url="javascript:$('#fileUpload').fileUploadStart()"]Start Upload[/url] | [url="javascript:$('#fileUpload').fileUploadClearQueue()"]Clear Queue[/url]
                


                </p>
            </fieldset>
        </div>
        <div style="float: left; margin-left: 20px">
            <div id="customspot">
            </div>
        </div>

    <%


    end function



    function TestEnvironment()
        Dim fso, fileName, testFile, streamTest
        TestEnvironment = ""
        Set fso = Server.CreateObject("Scripting.FileSystemObject")
        if not fso.FolderExists(uploadsDirVar) then
            TestEnvironment = "[B]Folder " & uploadsDirVar & " does not exist.[/B]
    The value of your uploadsDirVar is incorrect. Open uploadTester.asp in an editor and change the value of uploadsDirVar to the pathname of a directory with write permissions."
            exit function
        end if
        fileName = uploadsDirVar & "\test.txt"
        on error resume next
        Set testFile = fso.CreateTextFile(fileName, true)
        If Err.Number<>0 then
            TestEnvironment = "[B]Folder " & uploadsDirVar & " does not have write permissions.[/B]
    The value of your uploadsDirVar is incorrect. Open uploadTester.asp in an editor and change the value of uploadsDirVar to the pathname of a directory with write permissions."
            exit function
        end if
        Err.Clear
        testFile.Close
        fso.DeleteFile(fileName)
        If Err.Number<>0 then
            TestEnvironment = "[B]Folder " & uploadsDirVar & " does not have delete permissions[/B], although it does have write permissions.
    Change the permissions for IUSR_[I]computername[/I] on this folder."
            exit function
        end if
        Err.Clear
        Set streamTest = Server.CreateObject("ADODB.Stream")
        If Err.Number<>0 then
            TestEnvironment = "[B]The ADODB object [I]Stream[/I] is not available in your server.[/B]
    Check the Requirements page for information about upgrading your ADODB libraries."
            exit function
        end if
        Set streamTest = Nothing
    end function

    function SaveFiles
        Dim Upload, fileName, fileSize, ks, i, fileKey

        Set Upload = New FreeASPUpload
        Upload.Save(uploadsDirVar)

        ' If something fails inside the script, but the exception is handled
        If Err.Number<>0 then Exit function

        SaveFiles = ""
        ks = Upload.UploadedFiles.keys
        if (UBound(ks) <> -1) then
            SaveFiles = "[B]Files uploaded:[/B] "
            for each fileKey in Upload.UploadedFiles.keys
                SaveFiles = SaveFiles & Upload.UploadedFiles(fileKey).FileName & " (" & Upload.UploadedFiles(fileKey).Length & "B) "
            next
        else
            SaveFiles = "No file selected for upload or the file name specified in the upload form does not correspond to a valid file in the system."
        end if
        SaveFiles = SaveFiles & "
    Enter a number = " & Upload.Form("enter_a_number") & "
    "
        SaveFiles = SaveFiles & "Checkbox values = " & Upload.Form("checkbox_values") & "
    "
        SaveFiles = SaveFiles & "List values = " & Upload.Form("list_values") & "
    "
        SaveFiles = SaveFiles & "Text area = " & Upload.Form("t_area") & "
    "
    end function
    %>

    <HTML>
    <HEAD>
    <TITLE>Test Free ASP Upload 2.0</TITLE>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <style>
    BODY {background-color: white;font-family:arial; font-size:12}
    </style>
    <script>
    function onSubmitForm() {
        var formDOMObj = document.frmSend;
        if (formDOMObj.attach1.value == "" && formDOMObj.attach2.value == "" && formDOMObj.attach3.value == "" && formDOMObj.attach4.value == "" )
            alert("Please press the Browse button and pick a file.")
        else
            return true;
        return false;
    }
    </script>

    </HEAD>

    <BODY>




    <div style="border-bottom: #A91905 2px solid;font-size:16">Upload files to your server</div>
    <%
    Dim diagnostics
    if Request.ServerVariables("REQUEST_METHOD") <> "POST" then
        diagnostics = TestEnvironment()
        if diagnostics<>"" then
            response.write "<div style=""margin-left:20; margin-top:30; margin-right:30; margin-bottom:30;"">"
            response.write diagnostics
            response.write "

    After you correct this problem, reload the page."
            response.write "</div>"
        else
            response.write "<div style=""margin-left:150"">"
            OutputForm()
            response.write "</div>"
        end if
    else
        response.write "<div style=""margin-left:150"">"
        OutputForm()
        response.write SaveFiles()
        response.write "

    </div>"
    end if

    %>



    </BODY>
    </HTML> 

  2. #2
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,559
    Spiega meglio che vuol dire. Che errore ti da?

    Roby

  3. #3
    ciao robby_72 cerco di spiegarmi meglio..

    nella pagina default.asp ho una variabile "dir" che contiene il percorso dove salvare i file,
    quando richiamo la pagina carica.asp e recupero la variabile lo script si blocca.

    se invece utilizzo un percorso fisso uploadsDirVar = "C:\Inetpub\wwwroot\PUBLIC\img\oooo\" i file vengo caricari.

  4. #4
    quando esegui

    dir = request.Form("dir")
    uploadsDirVar = dir
    response.Write(uploadsDirVar)

    ti stampa qualcosa?

  5. #5
    ciao otpime,
    no nn mi stampa nulla, ammeno che gli metto un response.end() allora mi stampa il percorso....

  6. #6
    puoi usare

    dir = request.Form("dir")
    uploadsDirVar = dir
    response.Write("maGGica var...: " & uploadsDirVar)
    response.flush


    poi posta quello che viene a video

  7. #7
    ecco dopo il risultato:

    codice:
    Start Upload | Clear Queue
    
    Active Server Pages error 'ASP 0113'
    
    Timeout script
    
    /WexLite/carica.asp
    
    Il tempo massimo disponibile per l'esecuzione di uno script è stato superato. Per modificare tale limite di tempo, impostare la proprietà Server.ScriptTimeOut sul valore desiderato o modificarne direttamente il valore utilizzando gli strumenti di amministrazione di IIS.
    
    Active Server Pages error 'ASP 0113'
    
    Timeout script
    
    /WexLite/carica.asp
    
    Il tempo massimo disponibile per l'esecuzione di uno script è stato superato. Per modificare tale limite di tempo, impostare la proprietà Server.ScriptTimeOut sul valore desiderato o modificarne direttamente il valore utilizzando gli strumenti di amministrazione di IIS.

  8. #8
    pare che non abbia stampato niente...

  9. #9
    Si sopra ha stampato il percorso e sotto quel errore che ti ho messo..

  10. #10
    non ti è venuto in mente che mi interessasse anche la parte "sopra"?

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