PDA

Volledige versie bekijken : PDF uploaden


Malines
%Europe/Berlin %335 %2006, 09:02
Ey

ik heb scriptje voor pdf's te uploaden.

Hij werkt schijnbaar maar schrijft de file niet weg?
wat doe ik hier verkeerd?


//Allow this domain
System.security.allowDomain("http://localhost", "127.0.0.1");
import flash.net.FileReference;

for(var i:Number = 0; i< newsletters.length; i++){
removeMovieClip("pdf"+i);
}

var listener:Object = new Object();

listener.onSelect = function(selectedFile:FileReference):Void {
file_txt.text = selectedFile.name ;
status_txt.text = "Attempting uploading " + selectedFile.name ;
selectedFile.upload("PHP/upload.php");
};

// the file is starting to upload.
listener.onOpen = function(selectedFile:FileReference):Void {
status_txt.text = "Uploading " + selectedFile.name + "\n";
};

listener.onHTTPError = function(file:FileReference, httpError:Number):Void {
status_txt.text = "HTTPError number: "+httpError +"\nFile: "+ file.name;
}

listener.onIOError = function(file:FileReference):Void {
status_txt.text = "IOError: "+ pdfFile.name;
}

listener.onSecurityError = function(file:FileReference, errorString:String):Void {
status_txt.text = "SecurityError: "+SecurityError+"\nFile: "+ file.name;
}

// the file has uploaded
listener.onComplete = function(selectedFile:FileReference):Void {
status_txt.text += "Upload finished";
};


var pdfFile:FileReference = new FileReference();
pdfFile.addListener(listener);

upload_btn.onRelease = function(){
pdfFile.browse([{description: "PDF Files", extension: "*.pdf"}]);
}

function imageDownloaded(event:Object):Void {
if(event.total == -1) {
status_txt.text = "error";
}
}

stop();


dit is mijn PHP

if($_FILES['Filedata']['type'] == 'application/pdf')
move_uploaded_file($_FILES['Filedata']['tmp_name'], "../Newsletters/".$_FILES['Filedata']['name']);


alvast bedankt

Malines
%Europe/Berlin %460 %2006, 12:02
Niemand een iedee wat het kan zijn.

Heb al alles geprobeerd wat ik vond. Maar hij zegt dat het geupload is, maar hij wordt ni weggeschreven naar de juiste map.

extremefun1
%Europe/Berlin %642 %2006, 16:24
Ik heb pas geleden ook een upload ding gemaakt. Waarvan mijn PHP code is.

<?PHP
$target_path = "uploads/";
$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!";
}
?>

DEZE WERKT!

extremefun1
%Europe/Berlin %645 %2006, 16:28
Je kan dit overnemen of vergelijken, wat je het liefste wil ..dit werkt ook.

loader.status_txt.text = "Upload meter!";

import flash.net.FileReference;
Array1 = [{description: "ALL", extension: "*.jpg;*.png;*.exe;*.png;*.png;*.png;*.png;*.png;*. png;*.png"}]
var listener:Object = new Object();
listener.onSelect = function(file:FileReference):Void {
statusArea.text +="Opened: " + file.name+"\n";
statusArea.text +="Type: " + file.type+"\n";
statusArea.text +="Size: " + file.size+"\n\n";
fileRef.upload("upload.php");
}

listener.onCancel = function(file:FileReference):Void {
loader.status_txt.text = "Gestopt - selecteer een ander bestand!";
statusArea.text +="User stopped process\n";
}
listener.onProgress = function(fileRef:FileReference, bytesLoaded1:Number, bytesTotal1:Number) {
statusArea.text +=bytesLoaded1+ "bytes of the "+bytesTotal1+"bytes LOADED! \n";

}
listener.onComplete = function(file:FileReference):Void{
loader.status_txt.text = "Uploaden is succesvol voltooid!";
statusArea.text += "\nupload Complete!\n";
statusArea.text +="---------------------------------------------------\n";
}
listener.onIOError = function(file:FileReference):Void{
loader.status_txt.text = "Probleem: IO Error!"
statusArea.text += "\nUploading cancelled"
statusArea.text +="PROBLEM: IO Error!\n";
statusArea.text +="---------------------------------------------------\n";
}
listener.onSecurityError = function(file:FileReference, errorString:String):Void{
loader.status_txt.text = "Uploaden gestopt!";
statusArea.text += "\nUploading cancelled"
statusArea.text +="PROBLEM: Security Error:"+errorString+"\n";
statusArea.text +="---------------------------------------------------\n";
}

var fileRef:FileReference = new FileReference();
fileRef.addListener(listener);
fileRef.browse();