h

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

· 18년 전 · 3172

안녕하세요. 전에 이어서 플래쉬에서의 파일업로드를 구체적으로 설명하죠.
따라해보세요.
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,961
18년 전 조회 3,459
18년 전 조회 1,836
18년 전 조회 7,647
18년 전 조회 3,297
18년 전 조회 1,280
18년 전 조회 2,310
18년 전 조회 3,519
18년 전 조회 2,363
18년 전 조회 2,132
18년 전 조회 2,761
18년 전 조회 3,716
18년 전 조회 3,486
18년 전 조회 2,575
18년 전 조회 1,919
18년 전 조회 1,944
18년 전 조회 2,513
18년 전 조회 1,991
18년 전 조회 2,879
18년 전 조회 1,671
18년 전 조회 2,216
18년 전 조회 1,687
18년 전 조회 2,145
18년 전 조회 2,363
18년 전 조회 2,301
18년 전 조회 2,255
18년 전 조회 2,180
18년 전 조회 3,485
18년 전 조회 1,675
18년 전 조회 3,448
18년 전 조회 2,026
18년 전 조회 5,295
18년 전 조회 2,156
18년 전 조회 2,341
18년 전 조회 1,735
18년 전 조회 2,141
18년 전 조회 3,654
18년 전 조회 1,508
18년 전 조회 1,741
18년 전 조회 4,324
18년 전 조회 3,716
18년 전 조회 3,273
18년 전 조회 3,376
18년 전 조회 3,873
18년 전 조회 4,335
18년 전 조회 4,261
18년 전 조회 2,709
18년 전 조회 2,327
18년 전 조회 3,261
18년 전 조회 3,173
18년 전 조회 3,329
18년 전 조회 3,264
18년 전 조회 4,924
18년 전 조회 5,212
18년 전 조회 3,417
18년 전 조회 2,719
18년 전 조회 2,953
18년 전 조회 2,282
18년 전 조회 2,091
18년 전 조회 2,039
18년 전 조회 3,073
18년 전 조회 2,361
18년 전 조회 2,382
18년 전 조회 2,055
18년 전 조회 2,430
18년 전 조회 3,163
18년 전 조회 4,096
18년 전 조회 3,377
18년 전 조회 2,012
18년 전 조회 1,954
18년 전 조회 2,867
18년 전 조회 1,666
18년 전 조회 2,013
18년 전 조회 2,305
18년 전 조회 2,167
18년 전 조회 2,269
18년 전 조회 4,038
18년 전 조회 1,791
18년 전 조회 4,391
18년 전 조회 2,925
18년 전 조회 2,234
18년 전 조회 3,276
18년 전 조회 2,899
18년 전 조회 2,836
18년 전 조회 5,631
18년 전 조회 2,296
18년 전 조회 3,418
18년 전 조회 3,328
18년 전 조회 3,715
18년 전 조회 3,267
18년 전 조회 2,446
18년 전 조회 2,096
18년 전 조회 2,546
18년 전 조회 6,114
18년 전 조회 2,737
18년 전 조회 4,543
18년 전 조회 2,039
18년 전 조회 1만
18년 전 조회 2,488
18년 전 조회 1,551
🐛 버그신고