Zurück   Flashforum > Flash und Server > Server-Seite allgemein

Antwort
 
LinkBack Themen-Optionen Ansicht
Alt 27-01-2012, 10:40   #16 (permalink)
NCC 1701 D
 
Benutzerbild von speedjunkie
 
Registriert seit: Oct 2009
Ort: Metropolregion Hamburg
Beiträge: 588
Nimm if(!datei.name) return; raus.

Ist zu Sicherheit falls vorher jemand upload drückt und noch nichts selektiert hat.

Lasst ihr euch das format anzeigen dann wisst ihr es ganz genau!

trace(datei.type);
__________________
just be Daniel
JUNK FOOD: JavaScript Core Reference
speedjunkie ist offline   Mit Zitat antworten
Alt 27-01-2012, 10:47   #17 (permalink)
Neuer User
 
Registriert seit: Jan 2012
Beiträge: 15
ok, ich teste
ManuelZ ist offline   Mit Zitat antworten
Alt 27-01-2012, 10:49   #18 (permalink)
NCC 1701 D
 
Benutzerbild von speedjunkie
 
Registriert seit: Oct 2009
Ort: Metropolregion Hamburg
Beiträge: 588
zeig doch mal alles! das ist doch nicht schlimm…
__________________
just be Daniel
JUNK FOOD: JavaScript Core Reference
speedjunkie ist offline   Mit Zitat antworten
Alt 27-01-2012, 10:53   #19 (permalink)
Neuer User
 
Registriert seit: Jan 2012
Beiträge: 15
ActionScript:
  1. fuListener = new Object();
  2.     fuListener.onSelect = function(datei) {
  3.         /*debug_txt.text +="datei.type = "+datei.name+"\n";
  4.         if ((datei.type == ".jpg" || datei.type == ".JPG") && datei.size<=1536000) {
  5.             debug_txt.text +="4.1\n";
  6.             _root.mc_upload_window.fld_uploadFile.text = datei.name;
  7.             _root.mc_upload_window.btn_upload.enabled = true;
  8.             _root.mc_upload_window.btn_upload_border._visible = true;
  9.             _root.mc_upload_window.btn_search_border._visible = false;
  10.             _root.mc_upload_window.txt_btn_upload.textColor = 0x000000;
  11.             _root.mc_upload_window.fld_status.text = "";
  12.             debug_txt.text +="4.2\n";
  13.         } else {
  14.             debug_txt.text +="4.3\n";
  15.             _root.mc_upload_window.fld_uploadFile.text = "";
  16.             _root.mc_upload_window.btn_upload.enabled = false;
  17.             _root.mc_upload_window.btn_upload_border._visible = false;
  18.             _root.mc_upload_window.btn_search_border._visible = true;
  19.             _root.mc_upload_window.txt_btn_upload.textColor = 0x666666;
  20.             debug_txt.text +="4.4\n";*/
  21.         //function upload()
  22.         //{
  23.      
  24.         if (checkName(datei.type) && checkSize(datei.size))
  25.         {
  26.                 debug_txt.text +="4.1\n";
  27.                 _root.mc_upload_window.fld_uploadFile.text = datei.name;
  28.                 _root.mc_upload_window.btn_upload.enabled = true;
  29.                 _root.mc_upload_window.btn_upload_border._visible = true;
  30.                 _root.mc_upload_window.btn_search_border._visible = false;
  31.                 _root.mc_upload_window.txt_btn_upload.textColor = 0x000000;
  32.                 _root.mc_upload_window.fld_status.text = "";
  33.                 debug_txt.text +="4.2\n";
  34.         }
  35.         else
  36.         {
  37.                 debug_txt.text +="4.3\n";
  38.                 _root.mc_upload_window.fld_uploadFile.text = "";
  39.                 _root.mc_upload_window.btn_upload.enabled = false;
  40.                 _root.mc_upload_window.btn_upload_border._visible = false;
  41.                 _root.mc_upload_window.btn_search_border._visible = true;
  42.                 _root.mc_upload_window.txt_btn_upload.textColor = 0x666666;
  43.         if (datei.size>1536000) {
  44.                 debug_txt.text +="4.5\n";
  45.                 _root.mc_upload_window.fld_status.text = _root.var_txt_hinweis2;
  46.                 debug_txt.text +="4.6\n";
  47.             } else if (datei.type != ".jpg" || datei.type != ".JPG") {
  48.                 debug_txt.text +="4.7\n";
  49.                 _root.mc_upload_window.fld_status.text = _root.var_txt_hinweis3;
  50.                 debug_txt.text +="4.8\n";
  51.             }
  52.         }
  53.     }
  54.      
  55.     function checkName(a)
  56.     {
  57.         var b=a.lastIndexOf("."),a=a.substr(b).toLowerCase();
  58.         return".jpg"!=a&&".gif"!=a&&".png"!=a ? !1 : !0;
  59.     }
  60.      
  61.     function checkSize(a)
  62.     {
  63.         return 1536E3>=a?!0:!1;
  64.     }
  65.  
  66.     fuListener.onCancel = function(frObject) {
  67.         _root.mc_upload_window.fld_uploadFile.text = "";
  68.         _root.mc_upload_window.btn_upload.enabled = false;
  69.         _root.mc_upload_window.btn_upload_border._visible = false;
  70.         _root.mc_upload_window.btn_search_border._visible = true;
  71.         _root.mc_upload_window.txt_btn_upload.textColor = 0x666666;
  72.         _root.mc_upload_window.fld_status.text = _root.var_txt_hinweis4;
  73.     debug_txt.text +="1test\n";
  74.     };
so fängt der text bei ca zeile 600/1600 an.
selbes problem..
mit deiner erweiterung funktionierts zwar in MS so wie vorher, aber unter OSX immernoch nich.
ManuelZ ist offline   Mit Zitat antworten
Alt 27-01-2012, 10:55   #20 (permalink)
NCC 1701 D
 
Benutzerbild von speedjunkie
 
Registriert seit: Oct 2009
Ort: Metropolregion Hamburg
Beiträge: 588
if (checkName(datei.name) && checkSize(datei.size))

ich muss kurz weg
__________________
just be Daniel
JUNK FOOD: JavaScript Core Reference
speedjunkie ist offline   Mit Zitat antworten
Alt 27-01-2012, 11:03   #21 (permalink)
Neuer User
 
Registriert seit: Jan 2012
Beiträge: 15
ok, schonmal sehr gut^^
jetz schreibt ers rein, wenn ich jetz auf hochladen drück steht zwar 100% da, aber machts dann doch nicht^^
ManuelZ ist offline   Mit Zitat antworten
Alt 27-01-2012, 11:23   #22 (permalink)
Neuer User
 
Registriert seit: Jan 2012
Beiträge: 15
also es klappt soweit, bis er es "hochlädt"..
wir vermuten jetz allerdings, dass er den Befehl zum "Beenden" nicht bekommt, also das es fertig hochgeladen ist...
also hängt er dann beim hochladen fest^^ nur unter OSX
ManuelZ ist offline   Mit Zitat antworten
Alt 28-01-2012, 01:38   #23 (permalink)
NCC 1701 D
 
Benutzerbild von speedjunkie
 
Registriert seit: Oct 2009
Ort: Metropolregion Hamburg
Beiträge: 588
Ok in der Doc steht die SWF blockt bei OSX.

Wieso machst ihr so viel if else?

Du hast doch ein FileFilter, kannst da doch schon einschränken, so wie in der Doc.
swf im root

ActionScript:
  1. import flash.net.FileReference;
  2.  
  3. var imageTypes = {description:"Images (*.jpg, *.jpeg, *.gif, *.png)", extension:"*.jpg; *.jpeg; *.gif; *.png"}, fileRef = new FileReference(), listener = {};
  4.  
  5. function init():Void
  6. {
  7.     progressBar.visible = !1;
  8.     fileRef.addListener(listener);
  9. }
  10.  
  11. select_btn.onRelease = function():Void
  12. {
  13.     fileRef.browse([imageTypes]);
  14. };
  15.  
  16. listener.onSelect = function(file:FileReference):Void
  17. {
  18.     file_txt.text = file.name;
  19.     if (!checkSize(file.size) || !file.upload("http://localhost/remote/main_upload_access.php?"+(new Date).getTime(), "send_picture"))
  20.     {
  21.         status_txt.text = "Upload dialog failed to open.";
  22.     }
  23. };
  24.  
  25. listener.onCancel = function(file:FileReference):Void
  26. {
  27.     methodsDisplay_txt.text = "onCancel";
  28. };
  29.  
  30. listener.onOpen = function(file:FileReference):Void
  31. {
  32.     progressBar.visible = !0;
  33.     methodsDisplay_txt.text = "onOpen";
  34. };
  35.  
  36. listener.onProgress = function(file:FileReference, bytesLoaded:Number, bytesTotal:Number):Void
  37. {
  38.     progressBar.source = file;
  39.     //trace("onProgress with bytesLoaded: " + bytesLoaded + " bytesTotal: " + bytesTotal);
  40. };
  41.  
  42. listener.onComplete = function(file:FileReference):Void
  43. {
  44.     methodsDisplay_txt.text = "onComplete";
  45. };
  46.  
  47. listener.onHTTPError = function(file:FileReference):Void
  48. {
  49.     status_txt.text = "onHTTPError";
  50. };
  51.  
  52. listener.onIOError = function(file:FileReference):Void
  53. {
  54.     status_txt.text = "onIOError";
  55. };
  56.  
  57. listener.onSecurityError = function(file:FileReference, errorString:String):Void
  58. {
  59.     status_txt.text = "onSecurityError: " + file.name + " errorString: " + errorString;
  60. };
  61.  
  62. listener.onUploadCompleteData = function(fileRef:FileReference, data:String):Void
  63. {
  64.     progressBar.visible = !1;
  65.     status_txt.text = data;
  66. };
  67.  
  68. function checkSize(a):Boolean
  69. {
  70.     return 1536E3 >= a ? !0 : !1;
  71. }
  72. init();

php in _dir remote

PHP-Code:
<?php
    
isset($_FILES['send_picture']) || die("!! the job was not accepted !!"); // ist es 'send_picture' ansonsten brich ab
    
$_FILES['send_picture']['error'] && die("!! the job was not accepted. an ERROR has occurred. !!"); //bei Fehler brich ab
    
1536E3 $_FILES['send_picture']['size'] && die("!! the job was not accepted. the file is larger than 1.5MB !!"); //File größer als 1.5MB brich ab max in der php.ini 
    
$sourceDirectory "../upload";
    
$bmp $_FILES['send_picture']; //bmp für bitmap
    
require_once('Up.php'); // require
    
new Up($sourceDirectory$bmp);  // Klasse  
?>
PHP-Code:
<?php
final class Up
{
    private 
$path;
    private 
$timeStamp;
    private 
$newName;
    
    public function 
__construct($path$bmp)
    {       
        
$this->path $path;       
        
$this->save($bmp);
        return;
    } 
// end constructor
    
    
private function save($bmp)
    {
        
$mime $this->checkImage($bmp['tmp_name']);        
        
$fileExtension $this->check_MIME_Type($mime);        
        
$target $this->createNewImageName($bmp$fileExtension);
    
        if(@
move_uploaded_file($bmp['tmp_name'], $target))
    {
            
$tempFile $target;
            
chmod($tempFile,0644);
            echo 
"upload completed";        
    }
    else
    {
            die(
"failed to upload");
        }
        return;
        
    } 
// end function
    
    
private function createNewImageName($bmp$fileExtension)
    {
        
$this->timeStamp time();        
        
$this->newName basename($bmp['name']);
    
$this->newName preg_replace('/\.(jpe?g|gif|png)$/i'""$this->newName);
    
$this->newName preg_replace('/[^a-zA-Z0-9_-]/'""$this->newName);        
    
$this->newName .= "_$this->timeStamp.$fileExtension";
        return 
"$this->path/$this->newName";
    } 
// end function
    
    
private function checkImage($bmpTmpName)
    {
        
$bmpINFO getimagesize($bmpTmpName);
        if(!
=== $bmpINFO) die('There is no Image!');
        else return 
$bmpINFO['mime'];      
    } 
// end function
    
    
private function check_MIME_Type($mime)
    {        
        
$mimeTypes = array('image/jpeg' => 'jpg',
                           
'image/gif'  => 'gif',
                           
'image/png'  => 'png' );
        
        isset(
$mimeTypes[$mime]) ? $fileExtension $mimeTypes[$mime] : die("not the correct MIME format");
        return 
$fileExtension;
        
    } 
// end function
    
    
public function __destruct()
    {       
        return;
    } 
// end function
}
?>
hier test
__________________
just be Daniel
JUNK FOOD: JavaScript Core Reference
speedjunkie ist offline   Mit Zitat antworten
Alt 01-02-2012, 16:40   #24 (permalink)
Neuer User
 
Registriert seit: Jan 2012
Beiträge: 15
Wie kann ich jetz bei
ActionScript:
  1. function checkName(a)
  2.     {
  3.         var b=a.lastIndexOf("."),a=a.substr(b).toLowerCase();
  4.         return".jpg"!=a&&".gif"!=a&&".png"!=a ? !1 : !0;
  5.     }

mehr Datein einfügen??
und was bedeutet des !1 : !0??

brauch nämlich noch die datein
return".jpg"!=a&&".gif"!=a&&".jpe"!=a&&".ppt"!=a&& ".pdf"!=a&&".xls"!=a&&".doc"!=a&&".mpg"!=a&&".mpeg "!=a&&".avi"!=a&&".m4v"!=a&&".dot"!=a&&".zip"!=a&& ".swf"!=a !1 : !0;

habs so "vermutet"
^^
ManuelZ ist offline   Mit Zitat antworten
Alt 01-02-2012, 22:44   #25 (permalink)
NCC 1701 D
 
Benutzerbild von speedjunkie
 
Registriert seit: Oct 2009
Ort: Metropolregion Hamburg
Beiträge: 588
Zitat:
Zitat von ManuelZ Beitrag anzeigen
und was bedeutet des !1 : !0??
Kurzform von false und true

Hatte das rausgenommen und in der Methode:

fileRef.browse([imageTypes]);

ein Array übergeben die eine Art FileFilter enthält. Und nur kurz vor dem upload die Filegröße geprüft.

Ist das für ein Intranet oder für das Web?
__________________
just be Daniel
JUNK FOOD: JavaScript Core Reference
speedjunkie ist offline   Mit Zitat antworten
Alt 02-02-2012, 08:17   #26 (permalink)
Neuer User
 
Registriert seit: Jan 2012
Beiträge: 15
Des is komplett fürs web.
und noch ne frage, why is des maxsize bei
ActionScript:
  1. function checkSize(a)
  2.     {
  3.         return 1536E3>=a?!0:!1;
  4.     }
so komisch?^^
brauch des jetz nämlich für 5MB und hab ka, wie ich des jetz ändern soll^^

Geändert von ManuelZ (02-02-2012 um 08:28 Uhr)
ManuelZ ist offline   Mit Zitat antworten
Alt 02-02-2012, 10:14   #27 (permalink)
NCC 1701 D
 
Benutzerbild von speedjunkie
 
Registriert seit: Oct 2009
Ort: Metropolregion Hamburg
Beiträge: 588
ActionScript:
  1. function checkSize(a:Number):Boolean
  2. {
  3.     /*******************************************************
  4.     ** funktion mit Rückgabewert vom definierten Typ Boolean
  5.     ** erwartet ein Argument a: vom definierten Typ Number
  6.     ** return (Ausdruck gehrt zu Aufrufer zurück)
  7.     ** ?: boolescher Bedingungsoperator (drei Operanten)
  8.     ** ist a kleiner als 5242880 ? true : false*/
  9.     return 5242880 >= a ? !0 : !1;
  10. }
__________________
just be Daniel
JUNK FOOD: JavaScript Core Reference
speedjunkie ist offline   Mit Zitat antworten
Alt 02-02-2012, 10:59   #28 (permalink)
Neuer User
 
Registriert seit: Jan 2012
Beiträge: 15
Ok, thx
hat auch anders geklappt ^^
die Aufgabe is fertig..
danke für hilfe
ManuelZ ist offline   Mit Zitat antworten
Antwort

Lesezeichen

Themen-Optionen
Ansicht

Forumregeln
Es ist Ihnen nicht erlaubt, neue Themen zu verfassen.
Es ist Ihnen nicht erlaubt, auf Beiträge zu antworten.
Es ist Ihnen nicht erlaubt, Anhänge hochzuladen.
Es ist Ihnen nicht erlaubt, Ihre Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks sind an
Pingbacks sind an
Refbacks sind an


Ähnliche Themen
Thema Autor Forum Antworten Letzter Beitrag
[Flash CS4] File Upload für flash homepage erstellen xmax67821 Flash Einsteiger 2 02-09-2009 16:51
File Upload mit Flash 8 snibu Flash Einsteiger 1 05-02-2007 08:47
File Upload in Flash Professor-phil Flash MX 2004 22 02-07-2005 16:33
File Upload mit Flash ? schani Flash MX 3 04-09-2004 12:49
flash und PHP file Upload lookout PHP und MySQL 5 01-07-2003 14:35


Alle Zeitangaben in WEZ +1. Es ist jetzt 11:08 Uhr.

Domains, Webhosting & Vserver von Host Europe
Unterstützt das Flashforum!
Adobe User Group


Copyright ©1999 – 2012 Marc Thiele