Over a million developers have joined DZone.

Flex And PHP File Upload

·
Here is the php


\n";

/* Set the root node for the xml */
$xml_output .= "\n";

/* If file was moved and inserted */
if ( $result ) 
{
	/* Build the XML if file was successful */			     
	/* Set the child node */
    $xml_output .= "\t\n";
    
    /* status */
    $xml_output .= "\t\t" . "Successful" . "\n";
    
    /* file_name variable */
    $xml_output .= "\t\t" . $file_name . "\n";
    
    /* file_size variable */
	$xml_output .= "\t\t" . $file_size . "\n";
	
	/* file_type variable */
	$xml_output .= "\t\t" . $file_type . "\n";
	
	/* file_url variable */
	$xml_output .= "\t\t" . $file_url . "\n";
    
    /* Close the child result now and print the child result node out */
    $xml_output .= "\t\n";

}
    
} else {

	/* Set the content type for the browser */
	header("Content-type: text/xml");
	
	/* Set the header xml version */
	$xml_output = "\n";
	
	/* Set the root node for the xml */
	$xml_output .= "\n";

	/* Build the XML if file was un-successful */			     
	/* Set the child node */
    $xml_output .= "\t\n";
    
    /* status */
    $xml_output .= "\t\t" . "Error" . "\n";
    
    /* file_name variable */
    $xml_output .= "\t\t" . $file_name . "\n";
    
    /* file_name variable */
    $xml_output .= "\t\t" . "There was a problem uploading your file." . "\n";

    
    /* Close the child result now and print the child result node out */
    $xml_output .= "\t\n";
				
}

/* Close the parent results node */
$xml_output .= "";

/* Output all of the xml */
echo $xml_output; 



?> 


Here is the Flex.





	
		
	
			

		
		
			
			
		
			
		
		
			
		
		
				
				
				
					
	
	
			
			
				
			
			
				
			
			
	

Topics:

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}