View Full Version : Variables -> PHP -> another PHP

07-13-2003, 08:05 AM
Im trying to build remote admin for a real estate web. Problem is, somehow my variables get lost in the way from flash to php to another php. Its an upload mod where client can browse a picture from own hdd.

flash :
function PildiId(id) {
pilt = new Loadvars();
pilt.piltid = id;
pilt.path = _root.baas;
pilt.send ("http://www.realestate.ee/php/upload.php",pilt,"POST");

<form enctype="multipart/form-data" action="up.php" method="POST">
The file: <INPUT TYPE="file" NAME="userfile">
<input type="submit" value="Upload"></FORM>
<input type="hidden" name="path" value="<? urlencode ($_POST['path']);?>">

echo $_POST['path'];?> < ---- this one shows path OK.

up.php :
$path = "X:/WWW/realestate/".$_POST['path']; // < ---- FROM HERE THE PATH IS ALREADY GONE. It shows only X:/WWW/realestate/
$max_size = 200000;
if (!isset($_FILES['userfile'])) exit;
if (is_uploaded_file($_FILES['userfile']['tmp_name']))
{if ($_FILES['userfile']['size']>$max_size) { echo "The file is too big<br>\n"; exit; }
if (($_FILES['userfile']['type']=="image/gif") || ($_FILES['userfile']['type']=="image/pjpeg") || ($_FILES['userfile']['type']=="image/jpeg"))
$res = copy($_FILES['userfile']['tmp_name'], $path .$_FILES['userfile']['name']);
if (!$res) { echo "upload failed!<br>\n"; exit; } else { echo "upload sucessful<br>\n"; }
echo "File Name: ".$_FILES['userfile']['name']."<br>\n";
echo "File Size: ".$_FILES['userfile']['size']." bytes<br>\n";
echo "File Type: ".$_FILES['userfile']['type']."<br>\n";} else { echo "Wrong file type<br>\n"; exit; }}
echo "Path:".$path."<br>\n";


Any suggestions? Maybe theres something wrong with php.ini? I have register_globals off but i think thats not the problem.

07-16-2003, 09:09 AM
I figured it out :
up.php :

echo "<FORM ENCTYPE=\"multipart/form-data\" ACTION=\"up.php?path=".$_POST['path']."&picid=".$_POST['piltid']."&picnr=".$_POST['piltnr']."\" METHOD=\"POST\">
The file: <INPUT TYPE=\"file\" NAME=\"userfile\">
<INPUT TYPE=\"submit\" VALUE=\"Upload\"></FORM> ";
echo $_POST['piltid']."<br>";
echo $_POST['piltnr']."<br>";
echo $_POST['path']."<br>";?>

upload.php :

$path = "X:/WWW/realestate/".$_GET['path']."/";
$max_size = 1000000;
if (!isset($_FILES['userfile'])) exit;
if (is_uploaded_file($_FILES['userfile']['tmp_name']))
{if ($_FILES['userfile']['size']>$max_size) { echo "Fail on liiga suur, Max. on 1mb<br>\n"; exit; }
if (($_FILES['userfile']['type']=="image/gif") || ($_FILES['userfile']['type']=="image/pjpeg") || ($_FILES['userfile']['type']=="image/jpeg"))
$res = copy($_FILES['userfile']['tmp_name'], $path .$_GET['picid']."_".$_GET['picnr'].".jpg");
if (!$res) { echo "LAADIMINE EBAÕNNESTUS!<br>\n"; exit; } else { echo "laadimine edukas.<br>\n"; }
echo "Faili Nimi: ".$_FILES['userfile']['name']."<br>\n";
echo "Faili Suutus: ".$_FILES['userfile']['size']." bytes<br>\n";
echo "Faili Tüüp: ".$_FILES['userfile']['type']."<br>\n";} else { echo "Wrong file type<br>\n"; exit; }}
echo "Kataloogipuu:".$_GET['path']."<br>\n";
echo "Objekti ID:".$_GET['picid']."<br>\n";
echo "Pildi NR:".$_GET['picnr']."<br>\n";
echo "Uus Failinimi:".$_GET['picnr']."_".$_GET['picid'].".jpg<br>\n";