I know that this is a wellcovered topic, but every time I try making an upload I get a 401 or 403 error. So I figure it should be something with the permission, however, I’ve set all of the files and folder to ‘777’.
Anyone who has experienced the same problems?
Or if you have experience with this working, and know a tutorial which helped you, I would just love a link :sure:
Thanks for the help
BTW. my host is flashlevel.net, so it should be compatible with PHP, right?
i’ve used this code and it works perfect on my computer… i have php 5.0.4 installed… but when i put this on the web, it’s no longer working… what can cause this? i’m almost sure it’s something about security access
Make sure your directories or files you want to edit or write to have the security settings to 666 or 777.
Or for a directory it should look like this: drwxrwxrwx for a file -rwxrwxrwx.
In your ftp programme you can alter these permissions, right click > Properties
it’s set to 777… i’ve also added a input file in the php and the upload is working… the problem is that when i am uploading a file from the flash it’s not… also the browser seems to stop responding
does anyone have at least an ideea of what the problem could be? the php is from the same domain, the folder permissions are set correctly. I really need to get this fixed. Any help would be greatly appreciated. At least to point me to the right direction in fixing this problem. Thank you very much
<?PHP
$target_path = "images/";
$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!";
}
?>
The test.php is in the same directory with the test_upload.swf/html The permissions on the images folder are 777. The images folder is in the same location with the swf, php and html.
The flash code:
import flash.net.FileReference;
var listener:Object = new Object();
listener.onSelect = function(selectedFile:FileReference):Void {
statusArea.text += "Attempting to upload "+selectedFile.name+"
";
selectedFile.upload("test.php");
};
listener.onOpen = function(selectedFile:FileReference):Void {
fileName = "images/"+selectedFile.name;
statusArea.text += "images/"+selectedFile.name+"
";
};
listener.onComplete = function(selectedFile:FileReference):Void {
statusArea.text += "Downloading "+selectedFile.name+" to player
";
imageName = selectedFile.name;
downloadImage();
};
var imageFile:FileReference = new FileReference();
imageFile.addListener(listener);
function imageDownloaded(event:Object):Void {
if (event.total == -1) {
statusArea.text += "ERROR
";
}
}
uploadBtn.onRelease = function(){
imageFile.browse([{description:"Image Files", extension:"*.jpg;*.gif;*.png"}]);
}
function downloadImage(event:Object):Void {
_root.createEmptyMovieClip("holder",_root.getNextHighestDepth());
holder.loadMovie(fileName);
}
And here is the .fla file.
Test location is here: www.keyconcept.ro/work/onlinedesigner/test_upload.html
The code works perfectly on my home computer.
Also, when i open the page in IE, and i try to close it. It seems to get stucked on something
does someone know where the problem could be? could this be from the php file? or it is from the flash file? the php uploader works fine when a input file form is added to the php(the one with browse)
let’s ask this question different… has someone done file uploading on a server? if so, could you please share your php code and the fla files? thank you