Skip to main content
Inspiring
November 23, 2007
Question

trying to use FileReference class

  • November 23, 2007
  • 9 replies
  • 504 views
I have an html form for uploading an image file and a php script on the server. Everything works well so I figure I'd integrate the upload business into my Flash movie to make things a little neater. I can't understand what changes to make. I tried a few things that didn't work. I don't believe there's much to do, just switching a variable or two around. Here is the Flash script (right out of the book), and my php script that I was using with my html form (that was working),
This topic has been closed for replies.

9 replies

kglad
Community Expert
Community Expert
November 26, 2007
yes.

it's part of the upload() method.

are you moving your uploaded file from its temporary location to another location?
Inspiring
November 25, 2007
I am getting a listener "on complete" response in my flash movie. But there's no uploaded file on the server!
Inspiring
November 25, 2007
Yes, actually the php file: testUpload.php is in the php directory as well, ( I forgot I'd changed it from uploadmyPhoto.php).
My biggest concern is that I'm not sure I understand the following from 'help'
:---------------------------
The file is uploaded to the URL passed in the url parameter. The URL must be a server script configured to accept uploads. Flash Player uploads files using the HTTP POST method. The server script that handles the upload should expect a POST request with the following elements:
• A Content-Type element of multipart/form-data
• A Content-Disposition element with a name attribute set to "Filedata" and a filename attribute set to the name of the original file
• The binary contents of the file
---------------------------------
Does this mean that in my php script I should have the following, using the exact name 'Filedata' ?
$FiledataName=$_FILES['Filedata']['name'];

Also, regarding "multipart/form-data": This information is in the original html input form, but where is it in the Flash code above? How does the php script get it as it would from the form?
thank you , K?
kglad
Community Expert
Community Expert
November 25, 2007
then you should be using that php file name in your filereference upload() method.
Inspiring
November 25, 2007
I was unclear, sorry.
swf and html are in root directory
the directory called "php" is an immediate subdirectory of the root and it contains the file: "uploadmyPhoto.php"
kglad
Community Expert
Community Expert
November 24, 2007
that's not right.

if your swf and html are in your root directory, is there a subdirectory of your root directory named php (not PHP), and does it contain testUpload.php?
Inspiring
November 24, 2007
Both the swf and the Flash html are in the root directory so
Root/PHP i s the path.
Inspiring
November 24, 2007
Yes, Flash is in the root and php is insdie that.
kglad
Community Expert
Community Expert
November 24, 2007
is that path to uploadmyPhoto.php relative to your flash html (not swf) file?