안녕하세요.
홈피에 등록하면서 인사로 플래쉬에서 파일의 업로드에 대하여 써봅니다.
플래쉬와 PHP를 연동하려면 플래쉬쪽에서 파일을 업로드 하고 PHP쪽에서 업로드된파일을 받아 처리합니다.
플래쉬쪽에서의 액션코드를 보면 다음과 같습니다.
System.security.allowDomain("http://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);//파일다이얼로그열기 여기서 파일을 선택하지요.
PHP에서는 다음의 코드를 씁니다.(fileupload.php)
<?php
$f = $HTTP_POST_FILES['Filedata'];
$filename = "1.aa";
if (!copy($a['tmp_name'],$filename)) {
print ("failed to copy $file...<br>\n");
}
?>
위에서 보시는 바와 같이 플래쉬와 PHP는 대단히 쉬워요.
구체적인 설명이 요구되시면 문의 부탁...
안녕
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 7930 | 9년 전 | 476 | ||
| 7929 | 9년 전 | 410 | ||
| 7928 | 9년 전 | 486 | ||
| 7927 | 9년 전 | 390 | ||
| 7926 | 9년 전 | 696 | ||
| 7925 | 9년 전 | 421 | ||
| 7924 | 9년 전 | 403 | ||
| 7923 | 9년 전 | 390 | ||
| 7922 | 9년 전 | 420 | ||
| 7921 | 9년 전 | 435 | ||
| 7920 | 9년 전 | 345 | ||
| 7919 | 9년 전 | 356 | ||
| 7918 | 9년 전 | 510 | ||
| 7917 | 9년 전 | 363 | ||
| 7916 | 9년 전 | 452 | ||
| 7915 | 9년 전 | 467 | ||
| 7914 | 9년 전 | 476 | ||
| 7913 | 9년 전 | 655 | ||
| 7912 | 9년 전 | 490 | ||
| 7911 | 9년 전 | 409 | ||
| 7910 | 9년 전 | 460 | ||
| 7909 | 9년 전 | 574 | ||
| 7908 | 9년 전 | 512 | ||
| 7907 | 9년 전 | 448 | ||
| 7906 | 9년 전 | 468 | ||
| 7905 | 9년 전 | 434 | ||
| 7904 | 9년 전 | 422 | ||
| 7903 | 9년 전 | 434 | ||
| 7902 | 9년 전 | 606 | ||
| 7901 |
|
9년 전 | 772 | |
| 7900 | 9년 전 | 666 | ||
| 7899 | 9년 전 | 450 | ||
| 7898 | 9년 전 | 448 | ||
| 7897 | 9년 전 | 408 | ||
| 7896 | 9년 전 | 423 | ||
| 7895 | 9년 전 | 542 | ||
| 7894 | 9년 전 | 448 | ||
| 7893 | 9년 전 | 425 | ||
| 7892 | 9년 전 | 462 | ||
| 7891 | 9년 전 | 818 | ||
| 7890 | 9년 전 | 1237 | ||
| 7889 | 9년 전 | 772 | ||
| 7888 |
limsy1987
|
9년 전 | 587 | |
| 7887 | 9년 전 | 636 | ||
| 7886 | 9년 전 | 524 | ||
| 7885 | 9년 전 | 494 | ||
| 7884 | 9년 전 | 486 | ||
| 7883 | 9년 전 | 493 | ||
| 7882 | 9년 전 | 551 | ||
| 7881 | 9년 전 | 529 | ||
| 7880 | 9년 전 | 641 | ||
| 7879 | 9년 전 | 531 | ||
| 7878 | 9년 전 | 1302 | ||
| 7877 | 9년 전 | 826 | ||
| 7876 | 9년 전 | 567 | ||
| 7875 | 9년 전 | 640 | ||
| 7874 |
|
9년 전 | 835 | |
| 7873 | 9년 전 | 563 | ||
| 7872 | 9년 전 | 731 | ||
| 7871 | 9년 전 | 546 | ||
| 7870 | 10년 전 | 666 | ||
| 7869 | 10년 전 | 481 | ||
| 7868 | 10년 전 | 523 | ||
| 7867 | 10년 전 | 529 | ||
| 7866 | 10년 전 | 586 | ||
| 7865 | 10년 전 | 530 | ||
| 7864 | 10년 전 | 583 | ||
| 7863 | 10년 전 | 578 | ||
| 7862 | 10년 전 | 546 | ||
| 7861 | 10년 전 | 714 | ||
| 7860 | 10년 전 | 695 | ||
| 7859 | 10년 전 | 465 | ||
| 7858 | 10년 전 | 776 | ||
| 7857 | 10년 전 | 1161 | ||
| 7856 | 10년 전 | 585 | ||
| 7855 | 10년 전 | 824 | ||
| 7854 | 10년 전 | 757 | ||
| 7853 | 10년 전 | 662 | ||
| 7852 | 10년 전 | 583 | ||
| 7851 | 10년 전 | 586 | ||
| 7850 | 10년 전 | 655 | ||
| 7849 | 10년 전 | 426 | ||
| 7848 | 10년 전 | 492 | ||
| 7847 | 10년 전 | 731 | ||
| 7846 | 10년 전 | 516 | ||
| 7845 | 10년 전 | 493 | ||
| 7844 | 10년 전 | 455 | ||
| 7843 | 10년 전 | 493 | ||
| 7842 | 10년 전 | 477 | ||
| 7841 | 10년 전 | 447 | ||
| 7840 | 10년 전 | 463 | ||
| 7839 | 10년 전 | 515 | ||
| 7838 | 10년 전 | 576 | ||
| 7837 | 10년 전 | 405 | ||
| 7836 | 10년 전 | 452 | ||
| 7835 | 10년 전 | 535 | ||
| 7834 |
|
10년 전 | 1232 | |
| 7833 | 10년 전 | 499 | ||
| 7832 | 10년 전 | 476 | ||
| 7831 | 10년 전 | 639 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기