Hi guys, I put a good three or four hours into this issue and I have just flat out hit a wall. I'm just trying to upload a file onto my server and it's hiccuping. Strangly enough, this same general code worked for another version, it just decided to bite the dust this time. I have included as much of the code associated to this issue as I could so please forgive my redundancy here:
This is the head tag of the form being used. Yes, I do have 'enctype' which I notice is many times the problem with form-file-upload issues.
echo "<form onsubmit=\"return letsgo(this)\" id=\"userDetails\" name=\"userDetails\" method=\"post\" action=\"". $action ."\" enctype=\"multipart/form-data\">
<input type='hidden' name='MAX_FILE_SIZE' value='1000000'>";
The form is created by a function which looks through the database to generate the fields, that's why the name is in an array.
echo $print ."<br><input type=\"file\" name=\"form_data[$name]\">";
Some checks are done on the array and the information is then put in another array. I used the original array's data and the same error comes up... This is obviously the function call.
$file_name = $advanced->upload_file($fileValues[$i]);
This is the function that uploads the data. I thought I did everything correctly and have looked through many sites/tutorials about this. What's wierd is that when it fails, '$_FILES[$uploadfile]['error']' doesn't output anything.
function upload_file($uploadfile) {
$uploaddir = '/blah/blah/blah/public_html/php/DBObject/nu/v3/temp';
PRINT $uploaddir . "<br>";
if (move_uploaded_file($_FILES[$uploadfile]['tmp_name'], $uploaddir.$_FILES[$uploadfile]['name'])) {
$name = $_FILES[$uploadfile]['name'];
//Information to store in database for URL reference
echo("File uploaded: " . $_FILES[$uploadfile]['name'] . "");
}
else {
echo "Error in file upload of " . $uploadfile . ".<br>";
$error = $_FILES[$uploadfile]['error'];
echo "Error is: <b>" . $error . "</b>.<br>";
return false;
}
}
Thanks in advance guys, it's very appreciated.