9
I’m here with a problem making one upload of an XML file in PHP.
I have a form that allows me to select a file:
<form id="upload" action='' method='post' enctype="multipart/form-data" >
<input id='uploaded_file' type='file' name='uploaded_file' title="Procurar ficheiro" />
<input class="btn btn-primary" type="submit" name ="submitA_" value="Upload"/>
</form>
I have the code to read the file (through the DOM) and import the data to the BD:
$uploaded = (object) $_FILES['uploaded_file']; //line 42
$import->dom->load( $uploaded->tmp_name );
$import->updateDB();
What happens is when the file is relatively large (9MB), the object $uploaded->tmp_name
is left empty and, consequently, the upload for the comic book, below is the Warning of PHP:
Warning: Domdocument::load(): Empty string supplied as input on line 42
The $uploaded->error
is NULL
and the outcome of var_dump($uploaded);
is:
Object(stdClass)#2 (0) { }
Note: No php.ini
have upload_max_filesize = 128M
and max_execution_time = 60
Maybe your problem is the configuration of PHP, check the
upload_max_filesize
, what value is configured?– Vieira
That’s not the problem because I have the same server uploading up to 128 MB file
– Jorge B.
What have you got in
$uploaded->error
? If possible show the result ofvar_dump($uploaded);
.– Vieira
Check the script timeout if it is not "popping". It may be that the problem is in the upload time, not in the size. http://www.php.net/manual/en/function.set-time-limit.php
– Bacco
By the way, it would be nice to have a more descriptive title for the problem, what do you think? (besides the remaining Html5, dom and xml tags). Jaja I delete this comment here. It was part of the top, but it’s two separate subjects, and this one is just "guess".
– Bacco
@Bacco I have the
max_execution_time = 60
that arrives perfectly since not even 20 seconds it takes to read the file. A title type which?– Jorge B.
@Vieira already has the result of
var_dump
and of$uploaded->error
in the question.– Jorge B.
I’ve managed to find the problem: reply&#Thanks for the help.
– Jorge B.