안녕하세요. 전에 이어서 플래쉬에서의 파일업로드를 구체적으로 설명하죠.
따라해보세요.
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);//파일다이얼로그열기 여기서 파일을 선택하지요.
구체적인 설명이 요구되시면 문의 부탁...
안녕
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 1330 | 18년 전 | 1486 | ||
| 1329 | 18년 전 | 1718 | ||
| 1328 | 18년 전 | 1000 | ||
| 1327 | 18년 전 | 1422 | ||
| 1326 | 18년 전 | 2257 | ||
| 1325 | 18년 전 | 1142 | ||
| 1324 | 18년 전 | 1303 | ||
| 1323 | 18년 전 | 1567 | ||
| 1322 | 18년 전 | 1176 | ||
| 1321 | 18년 전 | 970 | ||
| 1320 | 18년 전 | 1194 | ||
| 1319 | 18년 전 | 1522 | ||
| 1318 | 18년 전 | 1648 | ||
| 1317 | 18년 전 | 1600 | ||
| 1316 | 18년 전 | 1210 | ||
| 1315 |
|
18년 전 | 8601 | |
| 1314 | 18년 전 | 1908 | ||
| 1313 | 18년 전 | 1495 | ||
| 1312 | 18년 전 | 1486 | ||
| 1311 | 18년 전 | 1782 | ||
| 1310 | 18년 전 | 1836 | ||
| 1309 | 18년 전 | 1226 | ||
| 1308 | 18년 전 | 985 | ||
| 1307 | 18년 전 | 2759 | ||
| 1306 | 18년 전 | 3109 | ||
| 1305 | 18년 전 | 2170 | ||
| 1304 | 18년 전 | 1556 | ||
| 1303 | 18년 전 | 1421 | ||
| 1302 | 18년 전 | 893 | ||
| 1301 | 18년 전 | 1778 | ||
| 1300 | 18년 전 | 5138 | ||
| 1299 | 18년 전 | 2857 | ||
| 1298 |
mixdesign
|
18년 전 | 2109 | |
| 1297 | 18년 전 | 3079 | ||
| 1296 | 18년 전 | 2546 | ||
| 1295 | 18년 전 | 2240 | ||
| 1294 |
onweb
|
18년 전 | 4560 | |
| 1293 |
onweb
|
18년 전 | 3491 | |
| 1292 | 18년 전 | 3456 | ||
| 1291 | 18년 전 | 4040 | ||
| 1290 | 18년 전 | 1905 | ||
| 1289 | 18년 전 | 1760 | ||
| 1288 | 18년 전 | 1731 | ||
| 1287 | 18년 전 | 1428 | ||
| 1286 | 18년 전 | 1264 | ||
| 1285 | 18년 전 | 1158 | ||
| 1284 | 18년 전 | 1159 | ||
| 1283 | 18년 전 | 1514 | ||
| 1282 | 18년 전 | 915 | ||
| 1281 | 18년 전 | 1271 | ||
| 1280 | 18년 전 | 1129 | ||
| 1279 | 18년 전 | 1147 | ||
| 1278 | 18년 전 | 3026 | ||
| 1277 | 18년 전 | 947 | ||
| 1276 | 18년 전 | 1157 | ||
| 1275 | 18년 전 | 2096 | ||
| 1274 | 18년 전 | 2225 | ||
| 1273 | 18년 전 | 1321 | ||
| 1272 | 18년 전 | 1913 | ||
| 1271 | 18년 전 | 1162 | ||
| 1270 | 18년 전 | 2497 | ||
| 1269 | 18년 전 | 6597 | ||
| 1268 |
페이지팩트
|
18년 전 | 3820 | |
| 1267 |
페이지팩트
|
18년 전 | 2228 | |
| 1266 |
|
18년 전 | 6294 | |
| 1265 | 18년 전 | 2585 | ||
| 1264 | 18년 전 | 2619 | ||
| 1263 | 18년 전 | 2122 | ||
| 1262 | 18년 전 | 2118 | ||
| 1261 |
페이지팩트
|
18년 전 | 2124 | |
| 1260 | 18년 전 | 3886 | ||
| 1259 |
|
18년 전 | 3935 | |
| 1258 |
|
18년 전 | 5038 | |
| 1257 | 18년 전 | 4138 | ||
| 1256 | 18년 전 | 2574 | ||
| 1255 | 18년 전 | 1811 | ||
| 1254 | 18년 전 | 2781 | ||
| 1253 | 18년 전 | 2717 | ||
| 1252 | 18년 전 | 2238 | ||
| 1251 | 18년 전 | 5416 | ||
| 1250 |
jbsstyle
|
18년 전 | 4763 | |
| 1249 |
|
18년 전 | 3773 | |
| 1248 | 18년 전 | 3453 | ||
| 1247 | 18년 전 | 2139 | ||
| 1246 | 18년 전 | 2136 | ||
| 1245 | 18년 전 | 3640 | ||
| 1244 |
|
18년 전 | 2283 | |
| 1243 |
|
18년 전 | 2494 | |
| 1242 | 18년 전 | 1767 | ||
| 1241 | 18년 전 | 4464 | ||
| 1240 | 18년 전 | 2153 | ||
| 1239 | 18년 전 | 2303 | ||
| 1238 | 18년 전 | 4042 | ||
| 1237 |
hwatta
|
18년 전 | 3893 | |
| 1236 | 18년 전 | 2117 | ||
| 1235 | 18년 전 | 2768 | ||
| 1234 | 18년 전 | 5145 | ||
| 1233 | 18년 전 | 2411 | ||
| 1232 |
|
18년 전 | 2952 | |
| 1231 | 18년 전 | 8503 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기