Yes you can, SimpleXML is going to create an object of that string, so it should be easy, for example:
print_r($xml->Course);
Or to get a specific property:
echo $xml->Course->CourseName;
Yes you can, SimpleXML is going to create an object of that string, so it should be easy, for example:
print_r($xml->Course);
Or to get a specific property:
echo $xml->Course->CourseName;
Hi!
Apparently you get NULL, but PHP is also sending a warning:
Warning: simplexml_load_string() expects parameter 1 to be string, object given
because $values->getCourseDetailResult
is an object, and outputs:
stdClass Object
(
[any] => XML is here ...
)
So change your previous:
$xml = simplexml_load_string($values->getCourseDetailResult);
To:
$xml = simplexml_load_string($values->getCourseDetailResult->any);
and it should work fine.
You can remove /usr/bin
. When not sure about the path of a command you can use env
, e.g.:
/usr/bin/env php script.php --attribute hello --import ../world.txt
but not in case of cd
, you don't need it.
In any case I'm not sure the above script will work, because the --file
attribute is the equivalent of the -f
flag, used by the PHP CLI SAPI to define a script or a file to execute, from man php
:
--file file
-f file Parse and execute file
I see that in your tutorial this is used to define a file to import in the script. If you see you cannot get it to work, then change the attribute to something else, like --import
and then in the code just replace:
$this->getArg('file')
with:
$this->getArg('import')
then it should work fine.
@k_manimuthu
Hi,
the FROM
statement is not allowed in the update query, this is reason you get the error. This will work:
UPDATE tb2,tb1 SET tb2.data = tb1.data WHERE tb1.id = tb2.id AND tb2.data IS NULL;
Which is almost the same of your previous query with Reverend Jim fix to match nulls. In alternative you can use a subquery:
UPDATE tb2 SET tb2.data = (SELECT data FROM tb1 WHERE tb1.id = tb2.id) WHERE tb2.data IS NULL;
Then check the contents of the debugger:
print_r($this->email->print_debugger());
You should be able to see the encoding, which is also visible looking at the headers of the received mail, but you should also be able to see if the connection to the SMTP server was done in UTF8 mode, for example:
250-8BITMIME
250-STARTTLS
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-CHUNKING
250 SMTPUTF8 <- this
Hi, set the default charset for the web server to UTF-8, you can do this by adding this directive into your .htaccess file:
AddDefaultCharset utf-8
And be sure default_charset
, in the php.ini file, is set correctly, otherwise set it dinamically:
ini_set('default_charset', 'UTF-8');
Hi,
regarding the ffmpeg execution in $RF->newname
are you returning only the filename or also the path in which this file is located? Is the destination path writable?
Regarding the execution of the controller from CLI, it seems you are autoloading the session library, this will give the kind of warnings and notices you are experiencing, solution is to load the session into each controller or to extend the session library to detect CLI requests:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class MY_Session extends CI_Session
{
public function __construct()
{
$CI = get_instance();
if($CI->input->is_cli_request())
return;
parent::__construct();
}
}
Just save it into application/libraries/MY_Session.php
.
Source: http://stackoverflow.com/a/8394485
It could be, do:
ls -lh /mnt
ls -lh /mnt/storage
ls -lh /mnt/storage/uploads
And return the output for each command. Question: the web server is chrooted?
Ok,
regarding the Alias directive, did you created the correct setup with a Directory directive as suggested by the documentation?
In particular, if you are creating an Alias to a directory outside of your DocumentRoot, you may need to explicitly permit access to the target directory.
Alias /uploads /mnt/storage/uploads/
<Directory /mnt/storage/uploads/>
Require all granted
</Directory>
In case you're NOT using Apache ver.2.4, then replace Require all granted
with:
Order allow,deny
Allow from all
And refer to the Apache documentation for your current version. This should fix the first error.
Also, try:
sudo chown -R www-data:www-data /mnt/storage/uploads/
sudo chmod -R 755 /mnt/storage/uploads/
The -R
flag will apply the rule to all subdirectories and files in the defined path. If it does not work extend it to the group: 775
. Check also the permissions of the mount point, i.e. storage
, when you re-mount the permission could change and deny the access.
Use an absolute path to define the destination directory, then test and check Apache & PHP error logs, it should return the reason: permissions, wrong destination or something else. In case of problems, return the error information and possibly, as suggested previously, your script.
My previous definition wasn't exact, my fault: you don't have to change the path for the clients, they will not spot any change, but you have to modify the destination path for the upload script.
does it shows the full path for file
No, the aliased path will not be directly accessible or visible so, only /uploads/file.ext
will be visible to clients. There are some constraints, so read the documentation carefully.
Also explain the reason, because you could simply use the Alias directive to point the external directory to clients:
Alias /uploads /etc/mnt/storage/uploads
that way you don't have to alter your scripts, but if your boss decision was taken for security reasons, then Alias is the wrong solution.
Hi!
Each field name of the form must be an array, so for example, change:
<select id="field-BX_height" name="BX_height">
To:
<select id="field-BX_height" name="BX_height[]">
As you are already doing with BX_NAME[]
, apply the same concept to height and weight and then it should work fine.
I see, thanks for sharing your solution! Besides my regular expression pattern was wrong, sorry for that... here's an updated version to match only \n
:
$pattern = '/^([\\\\]?n|[\n])(.*)+$/';
This will catch the line feed and the \n
when single quoted, in fact if you do:
$a = '\n';
echo ord($a);
You get 92 instead of 10, because it matches just the backslash. The above expression instead searches for both situations, here's a new example:
<?php
$array = array(
array('C1TEXT' => 'test'),
array('C1TEXT' => '\nb'), # single quotes
array('C1TEXT' => "\na"), # double quotes
array('C1TEXT' => '\r'),
array('C1TEXT' => '0003'),
);
foreach($array as $list => $lvalue)
{
foreach($lvalue as $key => $value)
{
preg_match('/^([\\\\]?n|[\n])(.*)+$/', $value, $match);
if($match)
unset($array[$list]);
}
}
print_r(array_merge($array));
The ending array_merge()
will reindex the array and outputs:
Array
(
[0] => Array
(
[C1TEXT] => test
)
[1] => Array
(
[C1TEXT] => \r
)
[2] => Array
(
[C1TEXT] => 0003
)
)
Doing a one more step, you can use the pattern to match the carriage return, as for the line feed echo ord('\r')
returns 92 instead of 13, but you can do a switch to catch the second character, i.e. r
, for example:
foreach($array as $list => $lvalue)
{
foreach($lvalue as $key => $value)
{
preg_match('/^([\\\\]?(n|r)|[\n|\r])(.*)+$/', $value, $match);
if($match)
switch(ord($match[2]))
{
# n
case 110:
# "\n" assumes 0 because:
# $match[0] & [1] will return 10 and
# $match[2] will be empty
case 0:
unset($array[$list]);
break;
# r
case 114: …
The function array_walk_recursive
will set the index key as second argument of the mapped function, the third argument will be the third of the function, since ltrim
takes only two arguments it's better to define a custom function.
Now, the main problem is that array_walk_*
cannot modify the structure of the array, so you cannot unset an index from the array, but you can change a value, in order to do this you must not return
but simply set the value, basically:
function a(&$value, $key, $options)
{
if(... condition ...)
$value = '';
}
Note the reference &$value
, otherwise the change is not registered by the original array.
The other problem is represented by the quotes, if in the array \n
is surrounded by single quotes, then it is not consider a line feed character, but two separated characters, if instead you use double quotes you have a line feed:
$a = '\n'; # two chars
$b = "\n"; # line feed
Now, you can use a regular expression to match both cases, a pattern like this '/[\n\-n](.*)+$/'
should work, and this is the full example:
<?php
function _ltrim(&$value, $key)
{
preg_match('/[\n\-n](.*)+$/', $value, $match);
if($match)
$value = '';
}
$array = array(
array('C1TEXT' => 'test'),
array('C1TEXT' => '\n'), # single quotes
array('C1TEXT' => "\n"), # double quotes
array('C1TEXT' => '\r'),
array('C1TEXT' => '0003'),
);
array_walk_recursive($array, '_ltrim');
print print_r($array) . PHP_EOL;
It will output:
Array
(
[0] => Array
(
[C1TEXT] => test
)
[1] => Array
( …
Ok, there is an API key for server applications and another for browser applications, with the Javascript Google Maps API, you must use the browser applications API Key.
Can you play the example code with your key?
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
html, body, #map-canvas { height: 100%; margin: 0; padding: 0;}
</style>
<script type="text/javascript"
src="https://maps.googleapis.com/maps/api/js?key=API_KEY">
</script>
<script type="text/javascript">
function initialize() {
var mapOptions = {
center: { lat: -34.397, lng: 150.644},
zoom: 8
};
var map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions);
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
</head>
<body>
<div id="map-canvas"></div>
</body>
</html>
If you replace API_KEY
with yours, you should be able to see the activity usage in the Google Developers Console.
If this does not help you, then please share an example that reproduces your issue.
Would those be in the same file or separate?
You can use both methods, by default the Windows setup will use a single file, httpd-vhosts.conf, as defined by httpd.conf. But you can change the statement to include any .conf file in the defined directory, for example:
IncludeOptional conf/sites-enabled/*.conf
Hmm, not that I'm aware of, but I haven't a good knowledge of Apache Windows setups, in linux each VirtualHost needs a specific DocumentRoot and a matching Directory, used to override the main configuration httpd.conf
, basically:
<VirtualHost *:80>
ServerName my.test.dev
DocumentRoot /var/www/test.dev
<Directory /var/www/test.dev>
# rules
</Directory>
</VirtuaHost>
Then try empty()
:
if( ! empty($trans_autista) && ! empty($cat))
{
# execute query
}
This will match null, false and empty strings: http://php.net/empty
But be careful: empty()
will match also 0
, so if you have a category 0 the condition will fail.
By the way, the insert query does not support the WHERE statements, you can do it by inserting the subquery in the first SELECT:
INSERT INTO trans_autista (autista, ditta) SELECT '$trans_autista', '$cat' FROM dual WHERE NOT EXISTS (select autista FROM trans_autista WHERE autista = '$trans_autista' AND ditta = '$cat') limit 1;
And it should work.
Hi,
If you are referring to the value of the variables then check it before executing the query:
if( ! is_null($trans_autista) && ! is_null($cat))
{
# execute query
}
If instead you are referring to the table rows, then create a unique index of autista
and ditta
columns. And then use INSERT IGNORE ...
It happens because the query returns FALSE instead of returning a result set, there is an error in your query, try to add the quotes around $name
:
... category = '$name' ...
But you should really switch to prepared statements:
Hi,
you can set only one thead
for each table, here you're setting two of them, and the number of columns must match those in the tbody
block. You can set multiple tbody
blocks, for example you can create a tbody block to emulate the second header. Otherwise you have to create two separated tables.
Really basic code looks like:
<table>
<thead>
<th></th>
<th></th>
<th></th>
<!-- sub header -->
<tbody>
<tr>
<td></td>
<td></td>
<td></td>
</tr>
<!-- data here -->
<tbody>
<tr>
<td></td>
<td></td>
<td></td>
</tr>
<tfoot>
<tr>
<td></td>
<td></td>
<td></td>
</tr>
</table>
Here's an example with two tbody blocks and arrays as dataset:
Just click Run to see the execution of the code. You can edit it, just be aware that in the next few hours (8pm PST) Runnable is going in maintainance mode, so any eventual draft you create will be deleted.
Besides your link is broken, is missing the .com
.
Since there were suggested few solutions... here's mine :p
Use CJS or GreaseMonkey (TamperMonkey in Firefox) extension to embed a tiny javascript:
Target = document.getElementsByClassName("post-first")[0];
Target.className="margin-bottom clear";
It removes .post-first
from the DOM and returns the standard styling for the first post. I find it really difficult to read all text in bold.
@Dany could you limit the new styling only to not logged users?
What's your purpouse? You cannot access the client path of an uploaded file, because the browser operates in a sandbox and will send only the file and the name.
If instead you simply want a link, then you cannot use the file input control, use text or if using HTML5, url:
<input type="text" name="link" />
<input type="url" name="link" />
the only difference between the two is the user experience, Google Chrome, for example, will require the user to type an url provided by the protocol, for example: http://
, ftp://
, file://
.
More information here: http://diveintohtml5.info/forms.html
Hi,
do you have some sort of referer filter that could block the access from your company network? Are you using access control directives to block an IP range or some specific user agents?
If not, then ask the hosting company if they banned your IPs from their network.
Ok, this seems to be the httpd.conf file not a VirtualHost config. Anyway, when you set the DocumentRoot
you must set a Directory
directive to setup the matching path that will store the website files, the values of both directives must match:
DocumentRoot "E:/public_html/SiteName"
<Directory "E:/public_html/SiteName">
So the configuration should look like this:
DocumentRoot "E:/public_html/SiteName"
<Directory "E:/public_html/SiteName">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.4/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# AllowOverride FileInfo AuthConfig Limit
#
#AllowOverride None
AllowOverride All
#
# Controls who can get stuff from this server.
#
Order allow,deny
Allow from all
</Directory>
Once you make a change remember to reload the server, otherwise it will continue to use the old configuration values.
Side note - Apache 2.4 introduced some changes regarding access control and other features:
Ok WordPress doesn't require that config, so it must be something with the virtualhost configuration, can you share it? Besides have you added index.php to the DirectoryIndex
directive?
Docs: http://httpd.apache.org/docs/2.4/mod/mod_dir.html#directoryindex
Ok, are you trying to install custom code? Sometimes the DocumentRoot should be something like:
E:/public_html/SiteName/public
It happens, for example, with Laravel and other frameworks or CMS systems: in the parent directory (i.e. E:/public_html/SiteName
) you install the application and the core data, in the DocumentRoot (i.e. E:/public_html/SiteName/public
) just the index page and the assets.
When the required setup is like the above then you experience this kind of issues.
By using PDO you can execute two prepared statements, for example:
<?php
try {
$pdo = new PDO("mysql:dbname=db", "user", "pass");
}
catch (PDOException $e) {
die('Connection failed: ' . $e->getMessage());
}
$value1 = 10;
$value2 = 2;
$stmt = $pdo->prepare("SET @a = ?");
$stmt->execute(array($value1));
$stmt = $pdo->prepare("UPDATE van SET position = @a:= @a + 1 where day = ?");
$stmt->execute(array($value2));
But if you do not need @a
somewhere else, then you can execute one single query:
$stmt = $pdo->prepare("UPDATE van SET position = ? + 1 where day = ?");
$stmt->execute(array($value1, $value2));
Have you set the DocumentRoot
with the correct path? Consider this must be an absolute path. More information here:
The first error happens because the throwExceptionOnError()
method is missing from your class. Regarding the second warning, as explained by the message: define the default timezone in your php.ini file or use:
date_default_timezone_set('UTC');
More information here:
By the way, the following class seems to match your constructor code, as you see, at the end of the file, there is also the missing method:
If you still don't solve then share your full class.
MySQL can store up to 16TB per table, but it depends on OS/filesystem in use, with linux the limit is 4TB per table, source:
MSSQL seems capable of 16TB:
I will add PostgreSQL to the comparison, which can handle up to 32TB per table:
If referring to filter_input()
this is not custom, it's part of PHP:
and it's ok, even submitting something like 10 OR 1=1
the filter will sanitize it to 1011
. But keep in mind that it doesn't affects $_GET
, $_POST
and $_REQUEST
, so never do:
$record = filter_input(INPUT_GET, 'recordID', FILTER_SANITIZE_NUMBER_INT);
if($record)
echo $_GET['recordID']; # <- not good
Because it will output the unsanitized data. In any case, if you're going to use this input in a query, then use prepared statements.
Hi,
try to understand how the infection was accomplished, if by using a compromised FTP account (check server logs, change passwords, secure client machines) or because of a code bug, in this last case there's a lot of documentation you can read:
Then if you have some doubts about specific procedures show us some example codes.
its fixed but the images are blur. its a transperancy thing?
Hmm, it depends which kind of image format you are using, PNG supports the alpha channel (i.e. transparency), JPEG no.
Also it depends on the original quality of the image, the amount of manipulations done, for example from jpeg to jpeg there is a constant loss of information, then the colorspace and the filter applied to the resize can help a lot, as also the unsharp method. With Imagemagick you can control colorspace, filters and the sharpness.
In practice you have to do some tests to create the best setup for the kind of images you're going to resize. For more information about filters, colorspace and sharpness read:
Not directly related to PHP:
and i am figuring that if i create three different folders (400X400, 150X150, THUMB) that will take space in the server right?
Yes, it can take space when you start to handle thousands of files, but it's worth to pre-process them because:
Ok, the above code seems fine to me.
Regarding your link, I see some PNG blob data injected directly in the source of the HTML page, so there's must be something else going on, which is probably related by the include of this script:
include('imagemagick.php');
If the above is this:
then you don't need it and you can remove it safely, that's just an example. And a part that, in the source, I can see the blocks generated by your script:
<a class="show-all-audio" href="#show-all-audio748" style="cursor:pointer" id="show_all_audio">
<img src="http://www.rovespier.com/uploads/thumbs/142271296722.gif" class="small_icon" original-title="hjhhj">
</a>
So, this part seems to work fine to me. Just a note: if this is a display page, then you should not resize the images each time, it's a resource intensive task, you should resize them during the upload progress and then simply link them.
Regarding this error:
PHP Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/ro265852/public_html/gd_imagic.php on line 4
Can you show full source of gd_imagic.php?
By the way, from the log you can see the document root:
/home/ro265852/public_html/
So, it's possible that my previous suggestion was wrong, because of the repetition of the public_html/
segment, the correct versions would be:
$src = $_SERVER['DOCUMENT_ROOT'] . '/uploads/photos/' . $filename;
$dst = $_SERVER['DOCUMENT_ROOT'] . '/uploads/thumbs/' . $filename;
Hello, sorry for late reply. So, you're almost there, when you define this:
$final_image='/public_html/uploads/photos/'.$filename;
You have to specify the full path, in relation with the document root, you can do it like this:
$final_image = $_SERVER['DOCUMENT_ROOT'] . '/public_html/uploads/photos/' . $filename;
This will add the missing part, apply the same variable to the write context:
$im->writeImage($_SERVER['DOCUMENT_ROOT'] . '/public_html/uploads/thumbs/' . $filename);
If it does not work this can be due to the permission settings of the destination directory, it needs to be writable by the PHP script.
About document root: http://php.net/manual/en/reserved.variables.server.php
Hope it helps, bye! :)
Oh, now I understand, no, you don't have to pass the $im
object to display the image you have to use the web server path.
In your previous script there is a problem here:
$final_image=$base_url.$path.$newdata;
Where $base_url
is probably your url, correct? If you use this Imagick will not be able to read, nor to write the file to the correct destination.
For example if you web server root is /var/www/domain.tld/
and the source directory is uploads/
, and the destination path is thumbs/
then the $final_image
path should look like:
$final_image = '/var/www/domain.tld/uploads/'.$filename;
After that, by using $im->writeImage()
without the first argument you overwrite the original image defined by $im->readImage($final_image)
, byt thesetting the argument with a new path you write the new image in a new directory, for example:
$im->writeImage('/var/www/domain.tld/thumbs/'.$filename);
Now, you have a query with which you retrieve the image_path
column:
select image_path from user_uploads where id=".$p
What is the content of this column? Path and filename? Can you show us some examples?
To display the new image through the browser, instead you have to use the web server path:
echo '<img src="http://www.domain.tld/thumbs/'.$filename.'" />';
Ok, the GD library is available also in the PHP linux distribution, however is you still want to use Imagick: which distro are you using: debian, ubuntu, centos? Do you have access to a linux command line (shell/terminal)? Are you sure ImageMagick and the library for PHP are not already installed?
To check if ImageMagick is there type this in the command line:
identify -version
It should return something like:
Version: ImageMagick 6.7.7-10 2014-03-06 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2012 ImageMagick Studio LLC
Features: OpenMP
Regarding Imagick instead, you can check if the extension is enabled through phpinfo()
or by using:
echo extension_loaded('imagick') ? 'true':'false';
if the extension is not enabled, you can check if it does exists by typing this in the linux command line:
locate imagick.so
Or, if locate
is missing or not updated, use:
find / -name imagick.so 2> /dev/null
Once you are sure about the existence of the file, just enable it by appending this to the php.ini file:
extension=imagick.so
Debian, Ubuntu and other derived distros from Debian use the apt interface to install software, so if you want to install the extension, type:
sudo apt-get install php5-imagick
As suggested in one of my previouses posts. For other distros, like Centos you have to use the rpm interface:
rpm install php5-imagick
If ImageMagick is missing in both cases you should get a notice and a suggest to continue the process by installing the missing …
@Simon your web server is a Windows system, correct? If yes, then the dll pack to download is dependant on the PHP version and the web server configuration, i.e. as Apache is operating. Look at this file name:
php_imagick-3.1.2-5.3-nts-vc9-x86.zip
php_imagick-3.1.2
stands for the Imagick version;5.3
stands for PHP version;nts
stands for Non-Thread-Safe against ts
for Thread-Safe, this is related to Apache multi-processing modules, if PHP works under Apache with mod_php then the package should match the same setup;vc9
is related to Visual Studio version, it's easy: if using PHP 5.3
and 5.4
it will always be vc9
, from PHP 5.5+
it's always vc11
;x86
is the platform, i.e. a 32bit CPU.Now, in case you still want to use Imagick, the server must be provided with ImageMagick:
However if your server is not provided with Imagick or ImageMagick, rather then trying to install it by yourself, the easiest solution is to use the GD library which most of the times is embedded in PHP.
The $headers
variable is not initialized, if you check the error log you should see a notice:
PHP Notice: Undefined variable: $headers in ...
for this reason the mail()
function will fail, to solve the problem you can remove it (since it's an optional argument), set it to NULL
or check the examples in the documentation:
Yes, if you're using Windows follow these instructions:
Under Ubuntu & Co. just type:
sudo apt-get install php5-imagick
Hi, I suppose SimpleImage is this:
Or a similar version of the above, the error in your code is that you're overwriting the variable $final_image
with the new instance of SimpleImage:
$final_image = '/path/to/file.jpg';
$final_image = new SimpleImage(); # <- value overwrite
$final_image->load($final_image); # <- error
So change the above to:
$image = '/path/to/file.jpg';
$final_image = new SimpleImage();
$final_image->load($image);
and it should work fine.
Hi,
check for GD or Imagick libraries, these are both part of PHP:
Also, when saving the images you should optimize them for the web, or at least reduce their quality, read about this topic here:
Anyway don't look only to the file size, but also to the total of the pixels, in particularly read about getimagesize()
:
A uploader could serve an apparently small file and crash PHP, for example with the below command in ImageMagick you can create a 2.3MB file with 20000 pixels per side, which uncompressed becomes a 3GB file:
convert -size 20000x20000 xc:white -quality 1% test.jpg
If submitted to a PHP script, this will probably crash because of exhausted memory:
For more information, search Daniweb, there are several threads about image resizing with PHP.
The method result_array()
will return an array, or an empty array if the query does not return any results, so:
if(count($events) > 0)
{
foreach($events as $event_item)
{
# ... code here ...
}
}
else
{
echo 'No items.';
}
It happens because the index $_FILES['uploaded']
is not set, this is defined by the attribute name of your input field:
<input type="file" name="uploaded" />
So check if the value is correct. In any case, in your script you should add a check to verify if the $_FILES
array is correctly set, for example:
if(array_key_exists('uploaded', $_FILES))
{
# run code here
}
Hi, can you explain your issue? The only problem I see is indentation and the variable $Ok
at line 9 which should be $ok
, PHP is case sensitive.
Hi!
I've experienced this kind of issue in past, it was due to a mismatch of mime-types and I fixed by updating the application/config/mimes.php file. But I was trying to upload PDFs and images.
Set the environment
constant in the main index.php file to the development
stage, set the log_threshold
to 4 in the application/config/config.php file and then create a new method in your controller to get a verbose output:
public function verbose_upload()
{
$config['upload_path'] = "./uploads";
$config['allowed_types'] = '*';
$this->load->library('upload', $config);
$this->upload->do_upload();
$data['errors'] = $this->upload->display_errors('<p>', '</p>');
$data['result'] = print_r($this->upload->data(), true);
$data['files'] = print_r($_FILES, true);
$data['post'] = print_r($_POST, true);
$this->load->view('result', $data);
}
And the view (result.php) will look like this:
<!DOCTYPE html>
<html>
<head>
<title>Verbose Upload</title>
</head>
<body>
<?php
if($errors)
{
echo "<h3>Errors</h3>";
echo $errors;
}
if($result)
{
echo "<h3>Result</h3>";
print_r("<pre>".$result."</pre>");
}
if($files)
{
echo "<h3>FILES array</h3>";
print_r("<pre>".$files."</pre>");
}
if($post)
{
echo "<h3>POST array</h3>";
print_r("<pre>".$post."</pre>");
}
?>
</body>
</html>
Now, no matter what happens you should see what is really sent from the browser. And check the CI logs to see if something is wrong.
If, for some reason, the Upload library is failing then you should get an output from the $_FILES
array which is independent from CI, hopefully this output could help us to understand the issue.