Форум Flasher.ru

Форум Flasher.ru (http://www.flasher.ru/forum/index.php)
-   ActionScript 1.0/2.0 (http://www.flasher.ru/forum/forumdisplay.php?f=93)
-   -   FileReference&переменные (http://www.flasher.ru/forum/showthread.php?t=83899)

ALLLCALL 18.08.2006 18:28

FileReference&переменные
 
Использую FileReference чтобы отправить файл на сервер, необходимо передавать еще логин и пароль чтобы авторизоваться. Как передать эти переменные вместе с файлом?
спасибо
использую слегка измененный флеш скрипт из хелпа

Код:

import flash.net.FileReference;


var listener:Object = new Object();



listener.onSelect = function(selectedFile:FileReference):Void {

        listener.act = "1";


  selectedFile.upload("http://test1.ru/test.php");
};

listener.onOpen = function(selectedFile:FileReference):Void {
  e_rr("Opening " + selectedFile.name + "\n");
};


listener.onComplete = function(selectedFile:FileReference):Void {


 e_rr( "Downloading " + selectedFile.name + " to player\n");


  imagesCb.addItem(selectedFile.name);


  imagesCb.selectedIndex = imagesCb.length - 1;


  downloadImage();
};

var imageFile:FileReference = new FileReference();
imageFile.addListener(listener);

uploadBtn.addEventListener("click", uploadImage);
imagesCb.addEventListener("change", downloadImage);
imagePane.addEventListener("complete", imageDownloaded);


function imageDownloaded(event:Object):Void {
  if(event.total == -1) {
    imagePane.contentPath = "Message";
  }
}


function downloadImage(event:Object):Void {
  imagePane.contentPath = "http://test1.ru/news/" + imagesCb.value;
}


function uploadImage(event:Object):Void {
  imageFile.browse([{description: "Image Files", extension: "*.jpg;*.gif;*.png"}]);
}


bbexp 18.08.2006 18:45

В хелпе по этому вопросу сказано, чно вместе с файлом можно отправлять переменные через url-запрос

то есть классические ?var1=val1&var2=val2

DarkLight 18.08.2006 20:42

Цитата:

Note: If your server requires user authentication, only SWF files running in a browser--that is, using the browser plug-in or ActiveX control--can provide a dialog box to prompt the user for a user name and password for authentication, and only for downloads. For uploads that use the plug-in or ActiveX control, and for uploads and downloads that use the stand-alone or external player, the file transfer fails.
Хелп Флеша


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

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