Lid |
|
Situatie schets:
Via flex/air upload ik files naar een server (dit is toch bedoeling).
Op de server staat een upload script dat alles moet afhandelen.
Wat gebeurt er
flex load het bestand zogenaamd wel op, en geeft mij een upload completed.
$_FILES is dus gevuld,
maar als ik aan de move_uploaded_file() kom,
gebeurt er niets, files worden niet in map geplaatst,
maar ik krijg ook geen echte error ofzo...
De code staat hieronder, (directory bestaat en heeft 777 rechten).
helemaal onderaan staat print_r van de $_FILES array
$file_temp = $_FILES['file']['tmp_name'];
$file_name = $_FILES['file']['name'];
$file_path = $_SERVER['DOCUMENT_ROOT']."/directorie/bestaat";
//checks for duplicate files
if(!file_exists($file_path."/".$file_name)) {
//complete upload
if(move_uploaded_file($file_temp,"$file_path/$file_name")){
$testit = "gelukt";
array_push($errors,"Gelukt.");
}else{
switch ($_FILES['file'] ['error']){
case 1:
$testit = '<p> The file is bigger than this PHP installation allows</p>';
break;
case 2:
$testit = '<p> The file is bigger than this form allows</p>';
break;
case 3:
$testit = '<p> Only part of the file was uploaded</p>';
break;
case 4:
$testit = '<p> No file was uploaded</p>';
break;
case 0:
$testit = '<p>Er is helemaal geen fout hier </p>';
break;
}
array_push($errors,"Gefaald.");
}
$value_to_write = print_r($_FILES,true);
}else {
$success = "false";
array_push($errors,"File already exists on server.");
}
$query = "INSERT INTO test (text) VALUES ('".$haha.$testit.$file_path."/".$file_name.$value_to_write."')";
mysql_query($query);
$file_temp = $_FILES['file']['tmp_name']; $file_name = $_FILES['file']['name']; $file_path = $_SERVER['DOCUMENT_ROOT']."/directorie/bestaat"; //checks for duplicate files //complete upload $testit = "gelukt"; }else{ switch ($_FILES['file'] ['error']){ case 1: $testit = '<p> The file is bigger than this PHP installation allows</p>'; break; case 2: $testit = '<p> The file is bigger than this form allows</p>'; break; case 3: $testit = '<p> Only part of the file was uploaded</p>'; break; case 4: $testit = '<p> No file was uploaded</p>'; break; case 0: $testit = '<p>Er is helemaal geen fout hier </p>'; break; } } $value_to_write = print_r($_FILES,true); }else { $success = "false"; array_push($errors,"File already exists on server."); } $query = "INSERT INTO test (text) VALUES ('".$haha.$testit.$file_path."/".$file_name.$value_to_write."')";
zo ziet $_FILES eruit
Array
(
[file] => Array
(
[name] => n1348170666_222091_3803.jpg
[type] => application/octet-stream
[tmp_name] => /tmp/phpYtdTAR
[error] => 0
[size] => 36338
)
)
( ( [name] => n1348170666_222091_3803.jpg [type] => application/octet-stream [tmp_name] => /tmp/phpYtdTAR [error] => 0 [size] => 36338 ) )
|