안녕하세요.
홈피에 등록하면서 인사로 플래쉬에서 파일의 업로드에 대하여 써봅니다.
플래쉬와 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는 대단히 쉬워요.
구체적인 설명이 요구되시면 문의 부탁...
안녕
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 8230 | 9년 전 | 116 | ||
| 8229 | 9년 전 | 110 | ||
| 8228 |
커네드커네드
|
9년 전 | 154 | |
| 8227 | 9년 전 | 191 | ||
| 8226 | 9년 전 | 208 | ||
| 8225 | 9년 전 | 190 | ||
| 8224 | 9년 전 | 184 | ||
| 8223 | 9년 전 | 163 | ||
| 8222 |
|
9년 전 | 240 | |
| 8221 | 9년 전 | 143 | ||
| 8220 | 9년 전 | 179 | ||
| 8219 | 9년 전 | 140 | ||
| 8218 | 9년 전 | 188 | ||
| 8217 |
star3840
|
9년 전 | 158 | |
| 8216 | 9년 전 | 224 | ||
| 8215 | 9년 전 | 176 | ||
| 8214 | 9년 전 | 273 | ||
| 8213 | 9년 전 | 224 | ||
| 8212 | 9년 전 | 139 | ||
| 8211 | 9년 전 | 310 | ||
| 8210 | 9년 전 | 318 | ||
| 8209 | 9년 전 | 391 | ||
| 8208 | 9년 전 | 282 | ||
| 8207 | 9년 전 | 283 | ||
| 8206 |
|
9년 전 | 241 | |
| 8205 | 9년 전 | 223 | ||
| 8204 | 9년 전 | 195 | ||
| 8203 | 9년 전 | 272 | ||
| 8202 | 9년 전 | 192 | ||
| 8201 | 9년 전 | 234 | ||
| 8200 | 9년 전 | 231 | ||
| 8199 | 9년 전 | 257 | ||
| 8198 | 9년 전 | 221 | ||
| 8197 | 9년 전 | 212 | ||
| 8196 | 9년 전 | 609 | ||
| 8195 | 9년 전 | 213 | ||
| 8194 | 9년 전 | 328 | ||
| 8193 | 9년 전 | 220 | ||
| 8192 | 9년 전 | 250 | ||
| 8191 | 9년 전 | 202 | ||
| 8190 | 9년 전 | 202 | ||
| 8189 | 9년 전 | 253 | ||
| 8188 | 9년 전 | 191 | ||
| 8187 | 9년 전 | 191 | ||
| 8186 | 9년 전 | 195 | ||
| 8185 | 9년 전 | 367 | ||
| 8184 | 9년 전 | 151 | ||
| 8183 | 9년 전 | 372 | ||
| 8182 | 9년 전 | 224 | ||
| 8181 | 9년 전 | 185 | ||
| 8180 | 9년 전 | 764 | ||
| 8179 | 9년 전 | 533 | ||
| 8178 | 9년 전 | 380 | ||
| 8177 |
kiplayer
|
9년 전 | 388 | |
| 8176 | 9년 전 | 420 | ||
| 8175 | 9년 전 | 293 | ||
| 8174 | 9년 전 | 296 | ||
| 8173 | 9년 전 | 388 | ||
| 8172 | 9년 전 | 253 | ||
| 8171 | 9년 전 | 230 | ||
| 8170 | 9년 전 | 349 | ||
| 8169 |
커네드커네드
|
9년 전 | 305 | |
| 8168 | 9년 전 | 375 | ||
| 8167 | 9년 전 | 372 | ||
| 8166 | 9년 전 | 281 | ||
| 8165 | 9년 전 | 218 | ||
| 8164 | 9년 전 | 360 | ||
| 8163 | 9년 전 | 347 | ||
| 8162 | 9년 전 | 354 | ||
| 8161 | 9년 전 | 367 | ||
| 8160 |
|
9년 전 | 558 | |
| 8159 | 9년 전 | 502 | ||
| 8158 | 9년 전 | 312 | ||
| 8157 | 9년 전 | 426 | ||
| 8156 | 9년 전 | 311 | ||
| 8155 | 9년 전 | 303 | ||
| 8154 |
00년생용띠
|
9년 전 | 642 | |
| 8153 | 9년 전 | 282 | ||
| 8152 |
|
9년 전 | 465 | |
| 8151 | 9년 전 | 462 | ||
| 8150 | 9년 전 | 567 | ||
| 8149 |
Jangfolk
|
9년 전 | 412 | |
| 8148 | 9년 전 | 232 | ||
| 8147 | 9년 전 | 431 | ||
| 8146 | 9년 전 | 507 | ||
| 8145 | 9년 전 | 458 | ||
| 8144 | 9년 전 | 421 | ||
| 8143 | 9년 전 | 253 | ||
| 8142 | 9년 전 | 482 | ||
| 8141 | 9년 전 | 429 | ||
| 8140 | 9년 전 | 976 | ||
| 8139 | 9년 전 | 329 | ||
| 8138 |
전갈자리남자
|
9년 전 | 436 | |
| 8137 | 9년 전 | 467 | ||
| 8136 | 9년 전 | 801 | ||
| 8135 |
|
9년 전 | 836 | |
| 8134 |
PlayPixel
|
9년 전 | 576 | |
| 8133 |
|
9년 전 | 493 | |
| 8132 | 9년 전 | 511 | ||
| 8131 | 9년 전 | 877 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기