Hi,
Can anyone help for this. In my project i uploaded files by using this query
@list(, , $imtype, ) = getimagesize($_FILES['photo']['tmp_name']);
// Get image type.
// We use @ to omit errors
if ($imtype == 3) // cheking image type
$photo_ext="png"; // to use it later in HTTP headers
elseif ($imtype == 2)
$photo_ext="jpeg";
elseif ($imtype == 1)
$photo_ext="gif";
$photo = file_get_contents($_FILES['photo']['tmp_name']);
$photo = mysql_real_escape_string($photo);
if($photo!=''){ $db->execute("UPDATE `emp_personal` SET `photo`='$photo', `photo_ext`='$photo_ext' WHERE `emp_id` ='$emp_id'");}
Upto some days it worked but, now it didn't give error and files are not uploaded. In this code files are not transfer to any folder only insert into database and accessed by some php code.
why this problem comes, any limit in saving or what reason can anyone suggest??
Thanks in advance
Error in File Upload
Moderator: General Moderators
Re: Error in File Upload
What is the value of $_FILES['photo']['error']?
Re: Error in File Upload
in this code it is not required.
now, the value of $photo = file_get_contents($_FILES['photo']['tmp_name']); is blank. no photo details coming in action page, i didn't get why!!!!!!
now, the value of $photo = file_get_contents($_FILES['photo']['tmp_name']); is blank. no photo details coming in action page, i didn't get why!!!!!!
- social_experiment
- DevNet Master
- Posts: 2793
- Joined: Sun Feb 15, 2009 11:08 am
- Location: .za
Re: Error in File Upload
Maybe but the error code will show if the file is uploaded or not, which might be causing the problemlina531 wrote:in this code it is not required.
PHP Manual wrote: Error Messages Explained
Since PHP 4.2.0, PHP returns an appropriate error code along with the file array. The error code can be found in the error segment of the file array that is created during the file upload by PHP. In other words, the error might be found in $_FILES['userfile']['error'].
UPLOAD_ERR_OK
Value: 0; There is no error, the file uploaded with success.
UPLOAD_ERR_INI_SIZE
Value: 1; The uploaded file exceeds the upload_max_filesize directive in php.ini.
UPLOAD_ERR_FORM_SIZE
Value: 2; The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form.
UPLOAD_ERR_PARTIAL
Value: 3; The uploaded file was only partially uploaded.
UPLOAD_ERR_NO_FILE
Value: 4; No file was uploaded.
UPLOAD_ERR_NO_TMP_DIR
Value: 6; Missing a temporary folder. Introduced in PHP 4.3.10 and PHP 5.0.3.
UPLOAD_ERR_CANT_WRITE
Value: 7; Failed to write file to disk. Introduced in PHP 5.1.0.
UPLOAD_ERR_EXTENSION
Value: 8; File upload stopped by extension. Introduced in PHP 5.2.0.
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
Re: Error in File Upload
Error checking is not required?lina531 wrote:in this code it is not required.
Because you didn't do any error checking!lina531 wrote:no photo details coming in action page, i didn't get why!!!!!!