+ Reply to Thread
Results 1 to 2 of 2

Limite di peso del file in un upload di file in flash

This is a discussion on Limite di peso del file in un upload di file in flash within the Flash Italiano forums, part of the Flash CS3 - CS4 - CS5 category; Ciao! Sto utilizzando questa semplice sorgente (as + php) che permette all'utente di caricare delle immagini dal sito in cui ...

  1. #1
    i.am Settled In i.am is on a distinguished road
    Join Date
    Jan 1970
    Posts
    9
    Rep Power
    0

    Limite di peso del file in un upload di file in flash

    Ciao!
    Sto utilizzando questa semplice sorgente (as + php) che permette all'utente di caricare delle immagini dal sito in cui si trova.
    E' già presente una restrizione per quanto riguarda l'estensione dei file permessi, in più ho bisogno anche di una limitazione per quanto riguarda il peso del file.
    Di seguito il codice AS:
    Code:
    //Allow this domain
    System.security.allowDomain("http://localhost/");
    import flash.net.FileReference;
    // The listener object listens for FileReference events.
    var listener:Object = new Object();
    
    // When the user selects a file, the onSelect() method is called, and
    // passed a reference to the FileReference object.
    listener.onSelect = function(selectedFile:FileReference):Void {
      //clean statusArea and details area
      statusArea.text = details.text = ""
      // Flash is attempting to upload the image.
      statusArea.text += "Verifica del file..." + selectedFile.name + "\n";
      // Upload the file to the PHP script on the server.
      selectedFile.upload("upload.php");
    };
    
    // the file is starting to upload.
    listener.onOpen = function(selectedFile:FileReference):Void {
      statusArea.text += "Caricamento in corso..." + "\n";
    };
    //Possible file upload errors
    listener.onHTTPError = function(file:FileReference, httpError:Number):Void {
    	imagePane.contentPath = "Errore";
    	imagePane.content.errorMSG.text = "HTTPError number: "+httpError +"\nFile: "+ file.name;
    }
    
    listener.onIOError = function(file:FileReference):Void {
    	imagePane.contentPath = "Errore";
    	imagePane.content.errorMSG.text = "IOError: "+ file.name;
    }
    
    listener.onSecurityError = function(file:FileReference, errorString:String):Void {
    	imagePane.contentPath = "Errore";
    	imagePane.content.errorMSG.text = "SecurityError: "+SecurityError+"\nFile: "+ file.name;	
    }
    
    // the file has uploaded
    listener.onComplete = function(selectedFile:FileReference):Void {
      // Notify the user that Flash is starting to download the image.
      statusArea.text += "Caricamento terminato.\nInvio del file" + " come anteprima.\n";
      //Show file details
      details.text = ""
      for(i in selectedFile) details.text +="<b>"+i+":</b> "+selectedFile[i]+"\n"
      // Call the custom downloadImage() function.
      downloadImage(selectedFile.name);
    };
    
    var imageFile:FileReference = new FileReference();
    imageFile.addListener(listener);
    
    uploadBtn.onPress = uploadImage;
    imagePane.addEventListener("Completato.", imageDownloaded);
    
    // Call the uploadImage() function, opens a file browser dialog.
    function uploadImage(event:Object):Void {
      imageFile.browse([{description: "File di immagine", extension: "*.jpg;*.gif;*.png"}]);
    }
    
    // If the image does not download, the event object's total property
    // will equal -1. In that case, display am error message
    function imageDownloaded(event:Object):Void {
      if(event.total == -1) {
        imagePane.contentPath = "Errore";	
      }
    }
    
    // show uploaded image in scrollPane
    //modificato da Linkbruttocane percorso per Hosting Windows
    function downloadImage(file:Object):Void {
      imagePane.contentPath =  "files/" + file;
    }
    
    stop()
    Qualche idea...?
    Grazie!

  2. #2
    i.am Settled In i.am is on a distinguished road
    Join Date
    Jan 1970
    Posts
    9
    Rep Power
    0

    Re: Limite di peso del file in un upload di file in flash

    Help!!!

+ Reply to Thread

Similar Threads

  1. Upload Di Grossi Grassi File !
    By nuovobuio in forum Actionscript 3.0 base
    Replies: 8
    Last Post: 25-06-10, 21:09
  2. Upload file con FTP via Flash
    By bslt in forum FLEX builder 3
    Replies: 5
    Last Post: 16-03-10, 11:59
  3. Problema upload file internet explorer
    By giorgio1986 in forum Flash CS3 | PHP | mySQL
    Replies: 2
    Last Post: 26-05-09, 16:32
  4. Probelm with upload text file and read data.
    By ksyz in forum Actionscript 3.0 newbies
    Replies: 0
    Last Post: 12-02-09, 17:58
  5. Inviare variabile insieme al file con upload()
    By thephilosopher in forum Actionscript 3.0 base
    Replies: 0
    Last Post: 28-09-08, 10:59

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts