Jump to content


upload file checker


  • You cannot reply to this topic
1 reply to this topic

#1 darkson01

    Young Padawan

  • Members
  • Pip
  • 114 posts
  • Gender:Male
  • Location:Scotland
  • Interests:Gfx, skateboarding, playing guitar, listening to punk music and flash!

Posted 21 February 2007 - 03:08 PM

ok i would to run some coding by your guys to see if you can help me locate the problem here.

flash button1
on (release) {
	import flash.net.FileReference;
	var allTypes:Array = new Array();
	var imageTypes:Object = new Object();
	imageTypes.description = "Images (*.jpg, *.jpeg, *.gif, *.png)";
	imageTypes.extension = "*.jpg; *.jpeg; *.gif; *.png";
	allTypes.push(imageTypes);
	var fileRef:FileReference = new FileReference();
	fileRef.addListener(listener);
	fileRef.browse(allTypes);
	var listener:Object = new Object();
	listener.onSelect = function(file:FileReference):Void  {
		test = file.name;
	};
}

flash button2
on (release) {
	loadVariablesNum("check.php", "", "POST");
	if (action == 2) {
		_root.gotoAndPlay(13);
	}
}

NOTE: test is a dynamic text feild and i have entered test into the vars box in the properties.

php
<?php
$imported = $_post['test'];
$filename = "http://www.whoarewe.info/images/$imported";

if (file_exists($filename)) {
   echo "status=The file exits&action=1";
} else {
   echo "The file does not exis&action=2";
}
?> 

now i thought that was all correct. The file anme appears in the "test" box but the php don't seem to be checkign to see if the file exist on the server. also i have to choose the file fromt he browser and then do it again before the name appears in test.

anyway, any help you guys can give would be fantastic!

#2 Demonslay

    P2L Jedi

  • Members
  • PipPipPip
  • 970 posts
  • Gender:Male
  • Location:A strange world where water falls out of the sky... for no reason.
  • Interests:Graphic Design, Coding, Splinter Cell, Cats

Posted 21 February 2007 - 11:01 PM

I do believe superglobals are case-sensitive.

<?php
$imported = $_POST['test'];
$filename = "http://www.whoarewe.info/images/{$imported}";

echo (file_exists($filename)) ? 'status=The file exists&action=1' : 'status=The file does not exist&action=2';
?>

I think it should look like that, I don't know, I've never dealt with PHP and Flash communicating much.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users