h

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

· 18년 전 · 3164

안녕하세요. 전에 이어서 플래쉬에서의 파일업로드를 구체적으로 설명하죠.
따라해보세요.
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,952
18년 전 조회 3,446
18년 전 조회 1,825
18년 전 조회 7,637
18년 전 조회 3,286
18년 전 조회 1,267
18년 전 조회 2,301
18년 전 조회 3,509
18년 전 조회 2,355
18년 전 조회 2,124
18년 전 조회 2,753
18년 전 조회 3,708
18년 전 조회 3,478
18년 전 조회 2,560
18년 전 조회 1,910
18년 전 조회 1,934
18년 전 조회 2,505
18년 전 조회 1,984
18년 전 조회 2,871
18년 전 조회 1,663
18년 전 조회 2,208
18년 전 조회 1,681
18년 전 조회 2,140
18년 전 조회 2,356
18년 전 조회 2,292
18년 전 조회 2,245
18년 전 조회 2,167
18년 전 조회 3,481
18년 전 조회 1,664
18년 전 조회 3,440
18년 전 조회 2,015
18년 전 조회 5,286
18년 전 조회 2,147
18년 전 조회 2,332
18년 전 조회 1,728
18년 전 조회 2,132
18년 전 조회 3,646
18년 전 조회 1,500
18년 전 조회 1,734
18년 전 조회 4,315
18년 전 조회 3,706
18년 전 조회 3,264
18년 전 조회 3,365
18년 전 조회 3,865
18년 전 조회 4,327
18년 전 조회 4,252
18년 전 조회 2,703
18년 전 조회 2,316
18년 전 조회 3,250
18년 전 조회 3,165
18년 전 조회 3,319
18년 전 조회 3,255
18년 전 조회 4,914
18년 전 조회 5,203
18년 전 조회 3,403
18년 전 조회 2,711
18년 전 조회 2,943
18년 전 조회 2,271
18년 전 조회 2,079
18년 전 조회 2,032
18년 전 조회 3,065
18년 전 조회 2,350
18년 전 조회 2,371
18년 전 조회 2,045
18년 전 조회 2,421
18년 전 조회 3,154
18년 전 조회 4,086
18년 전 조회 3,367
18년 전 조회 2,002
18년 전 조회 1,945
18년 전 조회 2,860
18년 전 조회 1,651
18년 전 조회 2,004
18년 전 조회 2,293
18년 전 조회 2,158
18년 전 조회 2,260
18년 전 조회 4,030
18년 전 조회 1,779
18년 전 조회 4,382
18년 전 조회 2,915
18년 전 조회 2,220
18년 전 조회 3,266
18년 전 조회 2,893
18년 전 조회 2,828
18년 전 조회 5,623
18년 전 조회 2,290
18년 전 조회 3,408
18년 전 조회 3,318
18년 전 조회 3,703
18년 전 조회 3,258
18년 전 조회 2,435
18년 전 조회 2,087
18년 전 조회 2,537
18년 전 조회 6,104
18년 전 조회 2,728
18년 전 조회 4,532
18년 전 조회 2,031
18년 전 조회 1만
18년 전 조회 2,477
18년 전 조회 1,540
🐛 버그신고