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]