Hi everybody!
I have a website with smf 2.0 integrated with the whole site, so for that reason I have in the header of every document of the web the SSI.php file loaded. I am programing for a section of the web (no for the forum) one file uploader, but I am having a problem. The script works perfectly, it is very easy and you can see here.
<?php
if ($imagen)
move_uploaded_file($HTTP_POST_FILES[file]['tmp_name'], "file");
?>
<form name="form" action="upload.php" method="post" enctype="multipart/form-data">
File: <input name="file" type="file" id="file" size="13" />
<input type="submit" name="submit" value="Send" />
</form>
The problem appears when I include the SSI.php file, before of that you choose the file, push send and the file was uploaded, but the same script with the SSI.php loaded doesn´t work >:(
<?php
include ("forum/ssi.php");
if ($imagen)
move_uploaded_file($HTTP_POST_FILES[file]['tmp_name'], "file");
?>
<form name="form" action="upload.php" method="post" enctype="multipart/form-data">
File: <input name="file" type="file" id="file" size="13" />
<input type="submit" name="submit" value="Send" />
</form>
The script doesn´t show any error, but when you look in the server there isn´t any file.
Does anybody know why the SSI.php file doesn´t allow the upload?? I cannot find any solution. Thank you very much
Try This ;):
<?php
include ("forum/ssi.php");
if ($imagen)
move_uploaded_file($HTTP_POST_FILES[file]['tmp_name'], "file");
<form name="form" action="upload.php" method="post" enctype="multipart/form-data">
File: <input name="file" type="file" id="file" size="13" />
<input type="submit" name="submit" value="Send" />
</form>
?>
That was a joke or what?? :-\ You just have move the "?>" to the end of the script and you left the html without a echo or a print :o
Nobody knows??
subzero_mb, do you still need help with this problem?
Not sure if this will help, but give the following a try:
<?php
include ("forum/ssi.php");
if ($imagen)
move_uploaded_file($HTTP_POST_FILES[file]['tmp_name'], "file");
echo '
<form name="form" action="upload.php" method="post" enctype="multipart/form-data">
File: <input name="file" type="file" id="file" size="13" />
<input type="submit" name="submit" value="Send" />
</form>';
?>
Try $_FILES instead of $HTTP_POST_FILES.
Thank you soooooo much SlammedDime!! You did it! That was the problem, if I use _FILES instead of HTTP_POST_FILES everything is ok. I don´t know why now works, could you explaind me the reason? Just for knowledge. SSI.php file locks Post variables? Thank you!
HTTP_POST_FILES is deprecated as of PHP 4.1.0, and is not a superglobal. It might have worked had you done global $HTTP_POST_FILES AFTER including SSI.php, but it would still be inproper, due to deprecation. $_FILES is the correct way these days to retrieve the information.
http://us.php.net/manual/en/reserved.variables.files.php