h

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

· 18년 전 · 3169

안녕하세요. 전에 이어서 플래쉬에서의 파일업로드를 구체적으로 설명하죠.
따라해보세요.
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,956
18년 전 조회 3,453
18년 전 조회 1,832
18년 전 조회 7,644
18년 전 조회 3,290
18년 전 조회 1,275
18년 전 조회 2,305
18년 전 조회 3,514
18년 전 조회 2,361
18년 전 조회 2,127
18년 전 조회 2,756
18년 전 조회 3,713
18년 전 조회 3,482
18년 전 조회 2,566
18년 전 조회 1,916
18년 전 조회 1,940
18년 전 조회 2,508
18년 전 조회 1,989
18년 전 조회 2,875
18년 전 조회 1,666
18년 전 조회 2,212
18년 전 조회 1,685
18년 전 조회 2,144
18년 전 조회 2,361
18년 전 조회 2,298
18년 전 조회 2,250
18년 전 조회 2,173
18년 전 조회 3,485
18년 전 조회 1,670
18년 전 조회 3,444
18년 전 조회 2,023
18년 전 조회 5,292
18년 전 조회 2,152
18년 전 조회 2,338
18년 전 조회 1,731
18년 전 조회 2,137
18년 전 조회 3,650
18년 전 조회 1,505
18년 전 조회 1,737
18년 전 조회 4,319
18년 전 조회 3,710
18년 전 조회 3,270
18년 전 조회 3,370
18년 전 조회 3,869
18년 전 조회 4,333
18년 전 조회 4,258
18년 전 조회 2,705
18년 전 조회 2,322
18년 전 조회 3,256
18년 전 조회 3,170
18년 전 조회 3,325
18년 전 조회 3,260
18년 전 조회 4,918
18년 전 조회 5,209
18년 전 조회 3,409
18년 전 조회 2,717
18년 전 조회 2,947
18년 전 조회 2,277
18년 전 조회 2,086
18년 전 조회 2,036
18년 전 조회 3,069
18년 전 조회 2,356
18년 전 조회 2,376
18년 전 조회 2,049
18년 전 조회 2,424
18년 전 조회 3,159
18년 전 조회 4,091
18년 전 조회 3,374
18년 전 조회 2,008
18년 전 조회 1,950
18년 전 조회 2,865
18년 전 조회 1,658
18년 전 조회 2,009
18년 전 조회 2,298
18년 전 조회 2,163
18년 전 조회 2,264
18년 전 조회 4,035
18년 전 조회 1,785
18년 전 조회 4,386
18년 전 조회 2,921
18년 전 조회 2,227
18년 전 조회 3,270
18년 전 조회 2,897
18년 전 조회 2,832
18년 전 조회 5,629
18년 전 조회 2,293
18년 전 조회 3,413
18년 전 조회 3,322
18년 전 조회 3,709
18년 전 조회 3,265
18년 전 조회 2,442
18년 전 조회 2,092
18년 전 조회 2,542
18년 전 조회 6,110
18년 전 조회 2,736
18년 전 조회 4,537
18년 전 조회 2,034
18년 전 조회 1만
18년 전 조회 2,482
18년 전 조회 1,546
🐛 버그신고