Question of variables and file download.

Hello

I have a uploader of file in AS3 and can successfully save a file using php.

I would also like to send variables with the file, php to process variables and display in Flash.

Separated, I was able to include flash-flash-php variables in a project, but I can't work on how to do this while also downloading a file.  I get a null reference error in the completeHandler function when flash tries to display the reactive power coming back from php.

Here is my AS3:

create a file from a string of text, it records, the bed, then download:

var newFile:File;

newFile = File.desktopDirectory.resolvePath ("my.xml");
var stream: FileStream = new FileStream();
Stream.Open (newFile, FileMode.WRITE);
stream.writeMultiByte (str, "utf - 8")
Stream.Close ();
stream.openAsync (newFile, FileMode.READ);

stream.addEventListener (Event.COMPLETE, uploadFile);

function uploadFile(evt:Event):void {}

var URLrequest:URLRequest = new URLRequest ("http://www.mysite.com.au/uploader_script.php");
var variables: URLVariables = new URLVariables();
variables.todayDate = new Date();
variables. Name = "Dude."
variables. Email = "[email protected]"; ""
variables.saveThisXML = "test record this";
variables.passwordString = 'parse ';
URLrequest.method = URLRequestMethod.POST;
URLrequest.data = variable;

newFile.addEventListener (Event.COMPLETE, completeHandler);
newFile.addEventListener (ProgressEvent.PROGRESS, progressHandler);
newFile.upload (URLrequest);

}

function completeHandler(evt:Event):void {}

var phpVar1 = evt.target.data.var1;
var phpVar2 = evt.target.data.var2;

result1_txt. Text = phpVar1;
result2_txt. Text = phpVar2;

uploaderMC.status_txt.text = newFile.name + 'has been uploaded.';

}

My PHP:

<? PHP

$Name = $_POST ['name'];
$filename = $_FILES ['Filedata'] ['name'];
$filetmpname = $_FILES ['Filedata'] ['tmp_name'];

$uname = $_POST ['email'];

Print two vars back-Flash, you can also use 'echo' instead of printing
print ' var1 = the domain name with a variable of $uname was sent to PHP and is back.';
print '& var2 = $uname is also defined in the variable 2 php.';

File on the server:
move_uploaded_file ($_FILES ['Filedata'] ['tmp_name'], $filename);

? >

It works fine download, but falls into the AS3 to var phpVar1 = evt.target.data.var1;

Is there an obvious reason that I'm missing?

Thanks for your time.

Shaun

Add your variables in your URLs and use $_GET in your php file to analyze the variables:

create a file from a string of text, it records, the bed, then download:

var newFile:File;

newFile = File.desktopDirectory.resolvePath ("my.xml");
var stream: FileStream = new FileStream();
Stream.Open (newFile, FileMode.WRITE);
stream.writeMultiByte (str, "utf - 8")
Stream.Close ();
stream.openAsync (newFile, FileMode.READ);

stream.addEventListener (Event.COMPLETE, uploadFile);

function uploadFile(evt:Event):void {}

var URLrequest:URLRequest = new URLRequest ("http://www.mysite.com.au/uploader_script.php?var1=" + all + "& var2 =" + whateverelse);
var variables: URLVariables = new URLVariables();
variables.todayDate = new Date();
variables. Name = "Dude."
variables. Email = "[email protected]";
variables.saveThisXML = "test record this";
variables.passwordString = 'parse ';
URLrequest.method = URLRequestMethod.POST;
URLrequest.data = variable;

newFile.addEventListener (Event.COMPLETE, completeHandler);
newFile.addEventListener (ProgressEvent.PROGRESS, progressHandler);
newFile.upload (URLrequest);

}

function completeHandler(evt:Event):void {}
       
var phpVar1 = evt.target.data.var1;
var phpVar2 = evt.target.data.var2;
   
result1_txt. Text = phpVar1;
result2_txt. Text = phpVar2;
 
uploaderMC.status_txt.text = newFile.name + 'has been uploaded.';

}

My PHP:

<>


$var1 = $_GET ['var1'];

$var2 = $_GET ['var2'];

$Name = $_POST ['name'];
$filename = $_FILES ['Filedata'] ['name'];
$filetmpname = $_FILES ['Filedata'] ['tmp_name'];

$uname = $_POST ['email'];

Print two vars back-Flash, you can also use 'echo' instead of printing
print ' var1 = the domain name with a variable of $uname was sent to PHP and is back.';
print '& var2 = $uname is also defined in the variable 2 php.';

File on the server:
move_uploaded_file ($_FILES ['Filedata'] ['tmp_name'], $filename);

?>

Tags: Adobe Animate

Similar Questions

  • Question about playlists and file nav

    Research in get a rocket, or a variant of the Sansa, b/c I get lazy with the long method involved in duty sync w/iPod songs and their playlists, even with the Zune.

    I have read the manual for the rocket, and it seems that I can just drag and drop the files on the drive. My question is can I make records, as driving music, trance, etc. And then put different songs in every folder and then be able to go into that folder and shuffle the songs in that folder?

    Second issue (assuming that my answer is not), is on the creation of playlist. Looks like I have to do inside WMP playlists and then sync it to the top? Is there another way? I read an old thread on the use of other software to generate the playlist, but my playlist would be basically all the songs in a particular folder (the one I'm talking to the 2nd paragraph).

    Thank you for any input!

    eli2k wrote:

    I have read the manual for the rocket, and it seems that I can just drag and drop the files on the drive. My question is can I make records, as driving music, trance, etc. And then put different songs in every folder and then be able to go into that folder and shuffle the songs in that folder?

    Yes, with the most recent firmware, you can browse and read in folder.

  • Restoration of deleted movies and files downloaded

    I tried to delete a file in one of my folders and accidentally clicked the remove file permanently and didn't know that before all my data have been deleted.  I searched my hard drive and found the names of files, but they are the only files of 1 k shortcut.  How to restore these it retrieve all.  I did a system restore but it restores programs and not the data or documents that I discovered.  I'm doing it at the lowest possible cost and would try and do it myself if possible.  So please offer suggestions and advice

    Thanks heaps

    This program is available for free http://www.piriform.com/recuva

    You use the computer as little as possible or you might overwrite the deleted files. For best results, remove the drive from your computer and install it in another computer as a secondary drive.

  • Question about variables and actions put forward in CP7 - display button once the user has clicked on many areas of click

    Hi all

    Can't seem to understand this one. I had assumed it should be fairly easy, but not... I'm quite inexperienced with variables so, maybe someone could help?

    Basically, the case is quite simple: I want a next button to be invisible until a user has clicked on several areas of click on a slide. Each box click click should disclose additional information on a topic. When all topics have been read, I want the nest button to appear.

    Any suggestions on how I could do it with as little effort as possible? Maybe I don't even have to use variables?

    Help much appreciated!

    Rgds,

    Casper

    Here's a forum thread where I introduced myself as a combination of two decisions:

    Re: Can I use conditional and advanced actions on the same button?

    An old article in which I have explained how to combine a standard action with a conditional: combining conditional in a fast action and standard

    Slightly different, because there is a sequence (which is not the case for you) and so that a variable is required: Blog after Posterous? - ClickClick - Captivate blog

    Learn more about the possible events to trigger actions: http://blog.lilybiri.com/events-and-advanced-actions

    Lilybiri

  • How the names of variables and units used in the binary output file

    My colleague will give me LabView generated from the binary files (*.dat). There are more than 60 variables (columns) in the binary output file. I need to know the names of variables and units, which I think he has already configured in LabView. Is there a way for him to produce a file that contains the name of the variable and unity, so that I'll know what contains the binary file? It can create an equivalent ASCII file with a header indicating the name of the variable, but it does not list the units of each variable.

    As you can tell I'm not a user of LabView, so I apologize if this question makes no sense.

    Hi KE,.

    an ASCII (probably the csv format) file is just text - and contains all data (intentially) written to. There is no special function to include units or whatever!

    Your colleague must save the information it records the names and values in the same way...

    (When writing to text files, it could use WriteTextFile, FormatIntoFile, WriteToSpreadsheetFile, WriteBinaryFile even could serve...)

  • js and css downloaded from apex of static files 4.2.4

    Hello

    1. I need to know in what file are stored files js downloaded from 'components shared - static files?

    2. I need to know in what file are stored the css files downloaded from "sharing of components - Cascading Style Sheets?

    My version of the apex is 4.2.4.

    Thank you

    Iulian

    Hi, Alban,.

    These files are not stored in a folder, they are stored in the database. You can access in your application by specifying

    • #APP_IMAGES #your_file_name.js (if it is a static file that is stored for an application) or
    • #WORKSPACE_IMAGES #your_file_name.js (if it is a static file for your workspace).

    The #APP_IMAGES # and #WORKSPACE_IMAGES # substitution variables will be automatically replaced with a URL to retrieve the files of the database.

    Concerning

    Patrick

    Member of the APEX development team

    My Blog: http://www.inside-oracle-apex.com

    APEX Plug-Ins: http://apex.oracle.com/plugins

    Twitter: http://www.twitter.com/patrickwolf

  • Trying to update my video player, I clicked on 'file' and then download it and I got was a full window of the computer language without option "run".

    Trying to update my video player, I clicked on 'file' and then download it and I got was a full window of the computer language without option "run".

    To jscher2000 ~ I did what you said and it says "Media player could not be verified for use in Firefox. Proceed with caution. My husband told me to just delete, so I think I'll do it. Thanks for your help! Nice day.

  • After the update the new version cannot determine file downloads. In the eyes to determine the file, but download files go in C / documents and settings even

    After the update the new version cannot determine file downloads. In the eyes to determine the file, but download files go in C / documents and settings even if I chose another folder

    Hello, there is a general regression in firefox 27 allowing any files to upload directly to a root drive. Please try to create a subfolder (like D:\Downloads) and set as the default location for downloads...

    See also bug #958899.

  • Downloads window blank and nothing download - only for PDF files?

    FF 25, Mac Mountain Lion.

    Last week, stopped download PDF files and the downloads window is empty. Tried Safe Mode and clear memory cache, as well as Disable selectively module DownloadHelper. Nothing has worked. Acrobat plugin is not used, I've always had PDF files in Acrobat itself opening.

    It seems to affect only PDF files.

    I do not have reset FF because it's so invasive and time-consuming. Any other solution before I resort to that (or switch to Chrome)?

    In order to change the default reader for PDF files (to not to open PDF files with the internal PDF reader to Firefox), do the following:

    1. Go to Tools > Options (or Firefox > Options).
    2. In the Options window, select the Applications tab.
    3. In the Search box, type PDF. You should find Portable Document Format (PDF).
    4. On the right referring, you should find a column of Action . To select your favorite PDF reader. In order to view PDFs in Firefox, choose Preview in Firefox.

    This solve your problems? The report please come back shortly.

  • Why complete web pages download as a file and a folder on the Mac rather than single file downloads in safari?

    Is it necessary to have a folder full of files and an individual folder appear whenever I want to download a full webpage in firefox. This is not the case in safari. It is annoying to have to keep two icons for each web page, and if I put the file icon in the folder other files download each web page is not a simple click of an icon to open the page in offline mode. I must go to the folder and find the file icon. Am I missing some settings so that it works as well in firefox, like in safari? Thank you.

    Safari uses webarchive format. http://en.Wikipedia.org/wiki/WebArchive

    Firefox does not include a similar feature, but a feature like this can be added via the MAF extension or the extension of UnMHT.

    https://addons.Mozilla.org/en-us/Firefox/addon/Mozilla-archive-format/?src=search

    https://addons.Mozilla.org/en-us/Firefox/addon/UnMHT/?src=search

  • During the download, the download of Firefox window appears and the file downloads to the correct location. However, it shows not listed in the download window. The window remains empty. I have to open each workstation instead.

    This is a new computer, and this problem has occurred since I installed Firefox. The settings in the general tab of the window Options look good. If I accidentally close a file downloaded, I can't return to the Firefox download window to reopen even if Firefox has never closed.

    Options > privacy-> = Remember download history history

    Is this selected pref?

  • Can I share a link to a document (for example, a .pdf file) for anyone to view and/or download?

    Can I share a link to a document (for example, a .pdf file) for anyone to view and/or download on iCloud drive?  I currently do with Copy.com and Dropbox.  If so, how.

    Post edited by: mac710

    iCloud drive does not have this capability. You must continue to use Dropbox or Copy.com.

  • Apple watch ever the size of the file download updates? I have little download caps and would like to know the size of the file before downloading. Also to take advantage of free download period... is 02:00 until 08:00 a way to schedule download

    Apple never shows the size of the file download updates? I have little download caps and would like to know the size of the file before downloading. Also to take advantage of free download period... 02:00 until 08:00 is there a way to plan downloads?

    Yes. Informed of an update, select "install tonight". The downloads will be scheduled to occur at 02:00 local time.

    Make sure that your MBA is connected to the power of this night there.

  • Unable to save the exe. files and install downloaded software

    Whenever I try to download the software lately, it fails and says diagnostic tests c documents c\documents and documents\downloads\ (s-ware no matter what I try d-load) pc - install .exe could not be saved because you cannot change the contents of this folder. Change the properties of the folder and try again, or try saving in a different location. What should I do to fix this?

    Quick workaround: choose a different location to save the file, for example, your office.

    Diagnose:

    What version of Windows you have, including the service pack?  If you are unsure, do a click right my computer and select Properties.

    If there are problems in one of the following steps, report the complete text of the error message without paraphrase.

    • Open My Documents.
    • Double-click the download folder to open it.  Any problem?
    • Assuming that downloads folder opens, click file > New > text document.  Press enter
    • It must be a file named new document texte.txt in the downloads folder (you can not see the txt at the end, depending on your settings).  Was there a problem in the creation of this document?
    • Assuming that the file has been created, double-click it to open it.  Type a few characters.  Save and close the document.  All the problems?
  • When I try to defrag, a window opens and closes and a file download-security warning. A loop repeats. Other programs to do the same thing. Please help me fix this loop? SOS?

    When I run defrag, an IE window opens and closes and a file download-security warning comes up and asks me to run or save the file name: c:\windows\system32 dfrgui.exe, if I hit then another warning of IE - sec stands up and says 'the Publisher could not be verified. Are you sure that you want to run. I struck and the loop repeats. I run a diag of the F10 boot menu with dell. They say that its software and non-material, pay! Microsoft says that Dell is responsible. Other programs to do the same thing. I've updated and rerun my AVG security without error. We are automatically updated, and no other programs were added. Please help me fix this loop? SOS?

    Vista - open file - security warning
    http://www.Vistax64.com/Vista-security/125044-open-file-security-warning.html

    How to repair the operating system and how to restore the configuration of the operating system to an earlier point in time in Windows Vista
    http://support.Microsoft.com/kb/936212/#appliesTo

    How to troubleshoot a problem by performing a clean boot in Windows Vista or in Windows 7
    http://support.Microsoft.com/default.aspx/KB/929135

    Your programs launch properly from Safe Mode?  Or Normal Mode if you create another user to test with?

    Vista advanced boot options
    http://Techblissonline.com/Vista-advanced-boot-options/

    Try running ChkDsk to check your drive for errors. Right click on your drive icon / properties / tools / error checking.  Try first by checking do not each box (that it will run in read-only mode) to see if it reports any problems file or hard drive.  If so, restart it by checking both boxes and restart to allow him to attempt to fix any problems found.

    I see a lot of recommendations here for programs such as -

    Malwarebytes' Anti-Malware
    http://www.Malwarebytes.org/MBAM.php

    SuperAntispyware
    http://SUPERAntiSpyware.com/

Maybe you are looking for

  • Never use wireless e-mail

    I have reception problems and get email on my Motorola Milestone by using my home wireless broadband connection. It always connects to my phone provider, and with my pay-as-you-go card, it becomes quite expensive. Oddly I can browse the wireless inte

  • SBS 2011 and Windows 2008 file share

    I have a sbs 2011 and a regular Server 2008 domain. I need to set up a file share that can see both areas. I discovered what a normal two-way transitive trust between them is a bad idea. Wanting to know if there is a better way to do it by side just

  • MX800 Conferencing Multisite

    Hi all Nice day! I have new MX800 room system endpoint and it will integrate video conference network (which has its existing server). What are the necessary additional licenses outside the software (ICA-MX800-MS) Multisite Option to support the mult

  • Photoshop is missing from the menu ' tools' drop-down bridge. I use CC Bridge and Photoshop CS6 on a Mac.

    Photoshop is missing from my bridge 'Tools' drop-down menu. I use CC Bridge and Photoshop CS6 on a Mac. I need to use the photoshop "image processor", but there is no tab of photoshop in the menu dropdown. There is no script Photoshop in my Bridge st

  • Pop - Up window at the click on Image

    Hi allCurrently, I am building a website for a client. On the personal page, I want it so that when someone clicks on the image of a person a small pop up in the Web site that contains more information about the person concerned.The effect I'm lookin