![]() |
|
||||||||||
|
|||||
|
[+4 06.04.07]
[+4 09.04.07] Регистрация: Apr 2006
Сообщений: 37
|
Здравствуйте. У меня написан Uploader:
import flash.net.FileReference;
var imageTypes:Object = new Object();
var listener:Object = new Object();
listener.onSelect = function(file:FileReference):Void {
log.addItem("File selected for upload");
filename_txt.text = file.name;
size.text = file.size;
type.text = file.type;
name.text = file.name;
datem.text = file.modificationDate;
datec.text = file.creationDate;
}
listener.onCancel = function(file:FileReference):Void {
log.addItem("File upload/download cancelled by user");
}
listener.onOpen = function(file:FileReference):Void {
log.addItem("onOpen: " + file.name);
}
listener.onProgress = function(file:FileReference, bytesLoaded:Number, bytesTotal:Number):Void {
progress.mode = "manual";
progress.setProgress(bytesLoaded, bytesTotal);
log.addItem("bytesLoaded: " + bytesLoaded + " bytesTotal: " + bytesTotal);
}
listener.onComplete = function(file:FileReference):Void {
progress._visible = false;
log.addItem("File is uploaded");
}
listener.onHTTPError = function(file:FileReference, httpError:Number):Void {
log.addItem("HTTP Error :" + httpError);
// Write code here to do corrective actions
}
listener.onIOError = function(file:FileReference):Void {
log.addItem("An IO Error occured");
}
listener.onSecurityError = function(file:FileReference, errorString:String):Void {
log.addItem("SecurityError: " + file.name + " ErrorString: " + errorString, "Error");
}
var fileRef:FileReference = new FileReference();
fileRef.addListener(listener);
browse.onRelease = function()
{
upload.enabled = true;
fileRef.browse();
}
upload.onRelease = function()
{
this.enabled = false;
/*** Change the URL here to point to the location where your upload.php resides **/
fileRef.upload("upload.php");
}
Последний раз редактировалось iNils; 31.03.2007 в 12:15. |
|
|||||
|
Et cetera
Регистрация: Sep 2002
Сообщений: 30,787
|
Пусть пошлет в php-скрипт, который проверит размер и выдаст результат, можно закачивать или нет.
|
|
|||||
|
Регистрация: Sep 2006
Адрес: Zaporozhye, Ukraine
Сообщений: 141
|
Какой смысл проверять перед отправкой? В процессе работы ведь не будет меняться ограничение.
Логично было бы перед загрузкой клипа загрузить конфиг, взять предельный размер и ругаться сразу после выбора файла. И написать где нибудь текст про ограничение размера. |
![]() |
![]() |
Часовой пояс GMT +4, время: 11:16. |
|
|
« Предыдущая тема | Следующая тема » |
|
|