Форум Flasher.ru
Ближайшие курсы в Школе RealTime
Список интенсивных курсов: [см.]  
  
Специальные предложения: [см.]  
  
 
Блоги Правила Справка Пользователи Календарь Сообщения за день
 

Вернуться   Форум Flasher.ru > Flash > ActionScript 3.0

Версия для печати  Отправить по электронной почте    « Предыдущая тема | Следующая тема »  
Опции темы Опции просмотра
 
Создать новую тему  
Старый 11.12.2009, 20:09
zurkis вне форума Посмотреть профиль Отправить личное сообщение для zurkis Найти все сообщения от zurkis
  № 2  
Ответить с цитированием
zurkis
 
Аватар для zurkis

Регистрация: Nov 2008
Адрес: Атланта
Сообщений: 1,271
Код AS3:
package {
import flash.display.Sprite;
import flash.text.TextField;
import flash.events.*;
import flash.net.*;
import fl.controls.Button;
public class FileUpload extends Sprite {
private var _output:TextField;
private var _fileReference:FileReference;
var browseButton:Button = new Button();
var uploadButton:Button = new Button();
public function FileUpload() {
browseButton.move(10, 30);
browseButton.buttonMode = true;
browseButton.label = "Browse";
browseButton.addEventListener(MouseEvent.CLICK, browseHandler);
addChild(browseButton);
uploadButton.move(120,30);
uploadButton.buttonMode=true;
uploadButton.label ="Upload";
uploadButton.addEventListener(MouseEvent.CLICK, uploadHandler);
uploadButton.visible = false;
addChild(uploadButton);
_output = new TextField();
_output.width = 400;
_output.height = 400;
_output.y = 75;
addChild(_output);
_fileReference = new FileReference();
_fileReference.addEventListener(Event.SELECT, selectHandler);
_fileReference.addEventListener(Event.CANCEL, cancelHandler);
_fileReference.addEventListener(ProgressEvent.PROG RESS,progressHandler);
_fileReference.addEventListener(IOErrorEvent.IO_ER ROR,ioErrorHandler);
_fileReference.addEventListener(SecurityErrorEvent .SECURITY_ERROR,securityHandler);
_fileReference.addEventListener(Event.COMPLETE, completeHandler);
}
private function browseHandler(event:MouseEvent):void {
_fileReference.browse();
}
private function selectHandler(event:Event):void {
_output.text = "Selected File";
_output.appendText("\nName: " + _fileReference.name);
_output.appendText("\nSize: " + _fileReference.size);
_output.appendText("\nCreated On: " + _fileReference.creationDate);
_output.appendText("\nModified On: " +_fileReference.modificationDate);
uploadButton.visible = true;
}
private function cancelHandler(event:Event):void {
_output.text = "Canceled";
}
private function uploadHandler(event:MouseEvent):void {
_fileReference.upload(new URLRequest("simpleFileUpload.php"));
}
private function progressHandler(eventrogressEvent):void {
_output.text = "file uploading\noprogress (bytes): " + event.bytesLoaded + " / " + event.bytesTotal;
}
private function ioErrorHandler(event:IOErrorEvent):void {
_output.text = "an IO error occurred";
}
private function securityHandler(event:SecurityErrorEvent):void {
_output.text = "a security error occurred";
}
private function completeHandler(event:Event):void {
_output.text = "the file has uploaded";
uploadButton.visible = false;
}
}
}
ну и php

PHP код:
<?php
move_uploaded_file
($_FILES['Filedata']['tmp_name'], 'uploads/'.$_FILES['Filedata']['name']);
?>
__________________
Пока я жив, Вы горем обеспечены

Создать новую тему   Часовой пояс GMT +4, время: 23:38.
Быстрый переход
  « Предыдущая тема | Следующая тема »  

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.


 


Часовой пояс GMT +4, время: 23:38.


Copyright © 1999-2008 Flasher.ru. All rights reserved.
Работает на vBulletin®. Copyright ©2000 - 2026, Jelsoft Enterprises Ltd. Перевод: zCarot
Администрация сайта не несёт ответственности за любую предоставленную посетителями информацию. Подробнее см. Правила.