Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 08-23-2006, 05:47 PM   #1
jdsflash
Senior Member
 
Join Date: Jun 2006
Posts: 145
Default File upload problem (roaming profiles)

Im using the code below to upload files to my server threw a php script. Im running into a problem uploading files that reside on our roaming profiles with in your instution. How do i get around this? If the files are on my hard drive it works just fine.



Code:
//Allow this domain

//Must be changed on new server
System.security.allowDomain("http://www.wisconline.org");
import flash.net.FileReference;
// The listener object listens for FileReference events.
var listener:Object = new Object();
// When the user selects a file, the onSelect() method is called, and
// passed a reference to the FileReference object.
listener.onSelect = function(selectedFile:FileReference):Void  {
	//clean statusArea and details area
	statusArea.text = details.text="";
	// Flash is attempting to upload the image.
	statusArea.text += "Attempting to upload "+selectedFile.name+"\n";
	// Upload the file to the PHP script on the server.
	selectedFile.upload("upload.php");
};
// the file is starting to upload.
listener.onOpen = function(selectedFile:FileReference):Void  {
	statusArea.text += "Uploading "+selectedFile.name+"\n";
};
//Possible file upload errors
listener.onHTTPError = function(file:FileReference, httpError:Number):Void  {
	imagePane.contentPath = "error";
	imagePane.content.errorMSG.text = "HTTPError number: "+httpError+"\nFile: "+file.name;
};
listener.onIOError = function(file:FileReference):Void  {
	imagePane.contentPath = "error";
	imagePane.content.errorMSG.text = "IOError: "+file.name;
};
listener.onSecurityError = function(file:FileReference, errorString:String):Void  {
	imagePane.contentPath = "error";
	imagePane.content.errorMSG.text = "SecurityError: "+SecurityError+"\nFile: "+file.name;
};
// the file has uploaded
listener.onComplete = function(selectedFile:FileReference):Void  {
	// Notify the user that Flash is starting to download the image.
	statusArea.text += "Upload finished.\n";
	//Show file details
	details.text = "";
	for (i in selectedFile) {
		details.text += "<b>"+i+":</b> "+selectedFile[i]+"\n";
	}
	_parent.Doc1Upload.play();
	_parent.doc1link = selectedFile.name;
	//write doc name to text box
	//_parent.Doc7 = _parent.doc1link;
	// Call the custom downloadImage() function.
	downloadImage(selectedFile.name);
};
var imageFile:FileReference = new FileReference();
imageFile.addListener(listener);
uploadBtn.onPress = uploadImage;
imagePane.addEventListener("complete", imageDownloaded);
// Call the uploadImage() function, opens a file browser dialog.
function uploadImage(event:Object):Void {
	imageFile.browse([{description:"All Files", extension:"*.jpg;*.gif;*.png;*.doc;*.pdf;*.mp3;*.wav;*.wmv;*.mpeg;*.avi;*.qt"}, {description:"Image Files", extension:"*.jpg;*.gif;*.png"}, {description:"Documents", extension:"*.doc;*.pdf"}, {description:"Audio", extension:"*.mp3;*.wav"}, {description:"Video", extension:"*.wmv;*.mpeg;*.avi;*.qt"}]);
}
//{description:"Audio", extension:"*.mp3;*.wav;*.wma"}
//, {description:"Video", extension:"*.wmv;*.mpeg;*.avi;*.qt"}
// If the image does not download, the event object's total property
// will equal -1. In that case, display am error message
function imageDownloaded(event:Object):Void {
	if (event.total == -1) {
		imagePane.contentPath = "error";
	}
}
// show uploaded image in scrollPane
function downloadImage(file:Object):Void {
	imagePane.contentPath = "./files/"+file;
}
stop();
jdsflash is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
problem w/ sound object file loading into a holder file echolizard ActionScript 2.0 0 03-14-2006 02:54 PM
flash 8 file upload help Paul Ferrie Flash 8 General Questions 0 11-07-2005 04:11 PM
Single file upload, from file path (f8) Summerschool23 Flash 8 General Questions 0 09-28-2005 01:33 AM
Should I embedded a swf file in html page to solve this problem? apple HTML and JavaScript 1 08-05-2005 01:54 PM


All times are GMT. The time now is 11:29 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.