A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Problem with image upload script passing variable to php script

Threaded View

  1. #3
    Junior Member
    Join Date
    Mar 2012
    Posts
    4

    PHP Upload script

    PHP upload script. I am able to statically change the $target_path so that the uploads are sent to a different bzp folder. When I try to get an id from the flash index page URL such as ?id=11, the id is blank. Any ideas?

    Code:
    <?php
    set_time_limit ( 240 ) ;
    
    //BlueZone
    $bzp_id="11"; // This Works
    //$bzp_id = htmlspecialchars($_GET['id']); //This doesn't work
    //BlueZone
    
    $file=$_FILES['Filedata'];
    
    for($k=0;$k<count($file['name']);$k++){
    	$target_path = "bzp".$bzp_id."/"; //$target_path = "bzp11/";
    	$target_path = $target_path . basename( $file['name'][$k]);
    	$orig=$target_path;
    	$info = pathinfo($target_path);
    	
    	$ctr=1; 
    	while(file_exists($target_path)){
    		$target_path=$info['dirname']."/".$info['filename'].$ctr.".jpg";//.$info['extension'];
    		$ctr++;
    	}
    	
    	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";
    
    ?>
    Last edited by Travelfrog; 03-23-2012 at 11:03 AM. Reason: added the url id variable

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