# FileReferenceList problem?

**URL:** <https://forum.kirupa.com/t/filereferencelist-problem/218521>\
**Category:** flash\
**Created:** [March 8, 2007, 1:01pm UTC](https://forum.kirupa.com/t/filereferencelist-problem/218521 "2007-03-08T13:01:03Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Genialiteten](https://avatars.discourse-cdn.com/v4/letter/g/8baadc/32.png) [@Genialiteten](https://forum.kirupa.com/u/Genialiteten)\
**Post date:** [March 8, 2007, 1:01pm UTC](https://forum.kirupa.com/t/filereferencelist-problem/218521/1 "2007-03-08T13:01:03Z")

</div>

Hey

I am making a system for making image galleries. I am trying to give the user the posibility to upload new pictures. To do this I am using Flash 8’s own FileReferenceList class. But when using it skips a huge part of the selected pictures. If I upload 30 small pictures only around 15 of them gets to the server. :ex: Does someone know the solution for this? :}

[U]Most of the Flash code:

[/U][COLOR=DimGray]//Browse og upload billeder  
var allImageTypes:Array = new Array();

var imageTypes:Object = new Object();  
imageTypes.description = “Images (\*.jpg, \*.jpeg, \*.png, _.swf)";  
imageTypes.extension = "_.jpg; \*.jpeg; \*.png; \*.swf”;

allImageTypes.push(imageTypes);

var listenerPict:Object = new Object();

listenerPict.onSelect = function(filePictRefList:FileReferenceList) {  
trace(“onSelect”);  
var list:Array = filePictRefList.fileList;  
var item:FileReference;  
for(var i:Number = 0; i \< list.length; i++) {  
item = list\*;  
item.addListener(this);  
item.upload(“upload.php?folder\_path=” + mappe\_txt.text + “/”);  
}  
}

listenerPict.onOpen = function(filePict:FileReference):Void {  
billede\_txt.text = filePict.name;  
}

listenerPict.onProgress = function(filePict:FileReference, bytesLoaded:Number, bytesTotal:Number):Void {  
preloader1.load\_bar.\_xscale = Math.floor(bytesLoaded / bytesTotal \* 100);  
billede\_txt.text = "L: " + bytesLoaded + " T: " + bytesTotal;

}

listenerPict.onComplete = function(filePict:FileReference):Void {  
billede\_txt.text = filePict.name;  
}

listenerPict.onHTTPError = function(filePict:FileReference, httpError:Number):Void {  
billede\_txt.text = "onHTTPError: " + filePict.name + " httpError: " + httpError;  
}

listenerPict.onIOError = function(filePict:FileReference):Void {  
billede\_txt.text = "onIOError: " + filePict.name;  
}

listenerPict.onSecurityError = function(filePict:FileReference, errorString:String):Void {  
billede\_txt.text = "onSecurityError: " + filePict.name + " errorString: " + errorString;  
}

var fileRef:FileReferenceList = new FileReferenceList();  
fileRef.addListener(listenerPict);

browsePictBut.onRelease = function(){  
uploadPict.enabled = true;  
fileRef.browse([{description: “Image files”, extension: “_.jpg;_.png;\*.swf”, macType: “JPEG;jp2\_;SWF”}]);  
}

[U][COLOR=Black]PHP code:

[/COLOR][/U][COLOR=Black][COLOR=DimGray]\<?PHP  
$target\_path = $\_GET[‘folder\_path’];

if ($target\_path != ‘’){  
$target\_path = $target\_path . basename( $\_FILES[‘Filedata’][‘name’]);  
if(move\_uploaded\_file($\_FILES[‘Filedata’][‘tmp\_name’], $target\_path)) {  
echo "The file “. basename( $\_FILES[‘Filedata’][‘name’]). " has been uploaded”;  
} else {  
echo “There was an error uploading the file, please try again!”;  
}  
}  
?\>[/COLOR][/COLOR][COLOR=Black]  
[/COLOR][/COLOR]
