A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Problem passing variable from flash upload script to php script

  1. #1
    Junior Member
    Join Date
    Mar 2012

    Problem passing variable from flash upload script to php script

    I am trying to integrate a flash upload script by adylevy. I have got the script working and uploading to a folder bzp11 but need to pass a property id number so that the upload can be stored in the correct folder. bzp11, bzp12, bzp13 etc;

    I added ?id=11 to the url of the index page. If I manually insert the id number 11 in static php code, it will insert the photos into bzp11 folder OK. When I try to get the number id number 11 from the URL, the upload throws an error.

    INDEX page where the flash uploader is.

    $info = pathinfo($_SERVER['REQUEST_URI']);
    if (empty($info['extension']))
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
    		<title>File Uploader - adylevy.com</title>
    		<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    		<script type="text/javascript" src="js/swfobject.js"></script>
    		<script type="text/javascript">
    			var flashvars = {};
    			flashvars.path = "<?php echo $path;?>";
    			var params = {};
    			params.menu = "false";
    			params.scale = "noscale";
    			params.salign = "tm";
    			var attributes = {};
    			attributes.align = "middle";
    			swfobject.embedSWF("swf/imgUpload.swf", "flashHolder", "100%", "100%", "10.0.0", false, flashvars, params, attributes);
    	<body style='background-color:#123456;margin:0px;padding:0px;'>
    		<div id='mainHolder' style='position:absolute;width:100%;height:100%;'>
    			<div id="flashHolder">
    				<a href="http://www.adobe.com/go/getflashplayer">
    					<img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" />
    PHP page where the flash uploader inserts into a specific folder.

    set_time_limit ( 240 ) ;
    $bzp_id="11"; // This Works
    //$bzp_id = htmlspecialchars($_GET['id']); //This doesn't work
    	$target_path = "bzp".$bzp_id."/"; //$target_path = "bzp11/";
    	$target_path = $target_path . basename( $file['name'][$k]);
    	$info = pathinfo($target_path);
    	if(move_uploaded_file($file['tmp_name'][$k], $target_path)) {
    	   // echo "status=1&filepath=$target_path&size=".$file['size'];
    	} else{
    	   // echo "status=0&msg=Error";
    echo "status=1";

  2. #2
    Registered User
    Join Date
    Feb 2001

    you could try to get a list of received variables.
    If you have access to system log file,
    for($_REQUEST as $key => $val) user_error("$key => $val");
    Otherwise, create a file
    $fp = fopen("log.tmp", "w");
    for($_REQUEST as $key => $val) fwrite($fp, "$key => $val\n");
    (On unix/linux server make sure that the file could actually be written, e.g. by uploading an empty file and using chmod rw-rw-rw in your ftp program


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Click Here to Expand Forum to Full Width

HTML5 Development Center