h

플래쉬쪽에서의 파일업로드

· 18년 전 · 3177

안녕하세요. 전에 이어서 플래쉬에서의 파일업로드를 구체적으로 설명하죠.
따라해보세요.
System.security.allowDomain("http://localhost/");//이 도메인을 설정해주지 않으면 PHP쪽에서 파일을 업로드 받지 못합니다. 그러니 여기서 http://localhost/는 PHP파일이 있는 웹서버의 url이지요. 전 내 컴에 php서버를 구축했으니까localhost로 됩니다.
import flash.net.FileReference;//파일을 다르기위해서 필요한 패키지의 참조입니다.

var allTypes:Array = new Array();
var imageTypes:Object = new Object();
imageTypes.description = "Images (*.jpg, *.jpeg, *.gif, *.png)";
imageTypes.extension = "*.jpg; *.jpeg; *.gif; *.png";
allTypes.push(imageTypes);//파일의 타입을 어레이로 설정합니다.

var listener:Object = new Object();//파일참조클래스변수를 위한 리스너를 만듭니다. 꼭이렇게 하는거 아니고요.

listener.onSelect = function(file:FileReference):Void {
    trace("onSelect: " + file.name);
 trace(this);
    if(!file.upload("http://localhost/fileupload.php")) {//파일업로드합니다.
        trace("Upload dialog failed to open.");
    }
}

listener.onCancel = function(file:FileReference):Void {//파일선택취소했을때처리
    trace("onCancel");
}

listener.onOpen = function(file:FileReference):Void {//파일열기했을떄처리
    trace("onOpen: " + file.name);
}

listener.onProgress = function(file:FileReference, bytesLoaded:Number, bytesTotal:Number):Void {
    trace("onProgress with bytesLoaded: " + bytesLoaded + " bytesTotal: " + bytesTotal);
}

listener.onComplete = function(file:FileReference):Void {//업로드완성
    trace("onComplete: " + file.name);
}

listener.onHTTPError = function(file:FileReference):Void {
    trace("onHTTPError: " + file.name);
}

listener.onIOError = function(file:FileReference):Void {
    trace("onIOError: " + file.name);
}

listener.onSecurityError = function(file:FileReference, errorString:String):Void {
    trace("onSecurityError: " + file.name + " errorString: " + errorString);
}

var fileRef:FileReference = new FileReference();
fileRef.addListener(listener);
fileRef.browse(allTypes);//파일다이얼로그열기 여기서 파일을 선택하지요.

구체적인 설명이 요구되시면 문의 부탁...
안녕

[이 게시물은 관리자님에 의해 2011-10-31 16:50:06 Flash에서 이동 됨]
|
댓글을 작성하시려면 로그인이 필요합니다.

프로그램

+
제목 글쓴이 날짜 조회
18년 전 조회 1,965
18년 전 조회 3,464
18년 전 조회 1,838
18년 전 조회 7,651
18년 전 조회 3,301
18년 전 조회 1,282
18년 전 조회 2,313
18년 전 조회 3,522
18년 전 조회 2,366
18년 전 조회 2,136
18년 전 조회 2,764
18년 전 조회 3,718
18년 전 조회 3,489
18년 전 조회 2,577
18년 전 조회 1,922
18년 전 조회 1,948
18년 전 조회 2,519
18년 전 조회 1,994
18년 전 조회 2,880
18년 전 조회 1,674
18년 전 조회 2,219
18년 전 조회 1,690
18년 전 조회 2,147
18년 전 조회 2,366
18년 전 조회 2,303
18년 전 조회 2,258
18년 전 조회 2,180
18년 전 조회 3,488
18년 전 조회 1,676
18년 전 조회 3,449
18년 전 조회 2,026
18년 전 조회 5,296
18년 전 조회 2,161
18년 전 조회 2,346
18년 전 조회 1,737
18년 전 조회 2,141
18년 전 조회 3,655
18년 전 조회 1,512
18년 전 조회 1,745
18년 전 조회 4,326
18년 전 조회 3,719
18년 전 조회 3,277
18년 전 조회 3,377
18년 전 조회 3,876
18년 전 조회 4,340
18년 전 조회 4,264
18년 전 조회 2,709
18년 전 조회 2,329
18년 전 조회 3,262
18년 전 조회 3,178
18년 전 조회 3,332
18년 전 조회 3,267
18년 전 조회 4,926
18년 전 조회 5,215
18년 전 조회 3,419
18년 전 조회 2,723
18년 전 조회 2,955
18년 전 조회 2,283
18년 전 조회 2,095
18년 전 조회 2,044
18년 전 조회 3,075
18년 전 조회 2,363
18년 전 조회 2,384
18년 전 조회 2,057
18년 전 조회 2,433
18년 전 조회 3,168
18년 전 조회 4,100
18년 전 조회 3,381
18년 전 조회 2,015
18년 전 조회 1,958
18년 전 조회 2,871
18년 전 조회 1,667
18년 전 조회 2,017
18년 전 조회 2,307
18년 전 조회 2,173
18년 전 조회 2,272
18년 전 조회 4,042
18년 전 조회 1,793
18년 전 조회 4,393
18년 전 조회 2,928
18년 전 조회 2,236
18년 전 조회 3,279
18년 전 조회 2,903
18년 전 조회 2,838
18년 전 조회 5,636
18년 전 조회 2,300
18년 전 조회 3,421
18년 전 조회 3,332
18년 전 조회 3,716
18년 전 조회 3,269
18년 전 조회 2,449
18년 전 조회 2,097
18년 전 조회 2,551
18년 전 조회 6,117
18년 전 조회 2,744
18년 전 조회 4,544
18년 전 조회 2,041
18년 전 조회 1만
18년 전 조회 2,490
18년 전 조회 1,554
🐛 버그신고