<help>,
Ok so this is my problem. I have a flash movie that allows users to uploads
two images to a server. What I'm trying to do is have the uploaded images go
directly to their user's directory. I need the upload.php file to figure out
which person is uploading an image. The problem is the php page that handles
the file uploads will not read in any global variables (i.e. POST, GET,
SESSION, COOKIE). Also FileReference.upload() doesn't allow you to send any GET
/ POST vars along with it (as far as I have tested and read about). I've been
working on this for four days now and have concluded it's something to do with
the Flash FileReference calling the php page. I believe for some reason when
FileReference calls the php page the web server doesn't like/allow/understand
how the page is called so it denies any global var requests. I know its flash
because it works if I use an html front end with the same php uploader page.
(It could also be a PHP config I'm over looking)
So the goal for you 'out of the box' thinkers is to get one single darn global
variable pulled into the php upload page. The ONLY way I can think of
accomplishing my goal is when every time a user creates an account and their
folder is created, it copies the php upload file to their directory. Then in
flash when a user needs to upload its calls the upload file in their respective
upload directory. Needless to say I do not want to do it this way because it's
a poor solution but I'm running out of ideas.
Also I know I can upload the images to a temp file name and then immediatly
move the image to the users folder but I I'm tentative to do it this way since
you could get two people uploading at the same time and one person would get
the second person's image and the second person would get an error.
<!--- actionscript code
this._fileRef.upload("upload.php"); <---- works but doesn't help
this._fileRef.upload("upload.php?user_id=4"); <---- works but doesn't pass
the variable
//-->
<?php
session_start();
$user_id = $_SESSION['user_id']; // Does not work
$user_id = $_COOKIE['user_id']; // Does not work
$user_id = $_GET['user_id']; // Does not work
$user_id = $_POST['user_id']; // Can't do with FileReference class
?>
</help>
German Hernandez - 22 Jun 2006 05:34 GMT
Hi, hope is not to late for an answer. I had the same problem but could
upload file with the next code:
Actionscript
_fileToUpload.upload(_serverInfo._rootPath+"/"+_serverInfo._functionsPath+"/"+_serverInfo._uploadFile+"?uploadPath="+uploadPath);
<?php
$uploadPath = $_GET['uploadPath'];
move_uploaded_file($_FILES['Filedata']['tmp_name'],
$uploadPath."/".$_FILES['Filedata']['name']);
?>
hope is not to complicated to read my code
German
> <help>,
>
[quoted text clipped - 60 lines]
>
> </help>