cant get file upload to work on localhost
Moderator: General Moderators
cant get file upload to work on localhost
i swear... configuration problems are the most frustrating thing in the world. I could punch a kitten right now. anyway... I cannot get file uploads to work on my local machine. I have my upload_tmp_dir set to "C:\tmp\uploads". I upload a file, and it says in the $_FILES array that there is now a file available at "C:\tmp\uploads\php86.tmp" but then I go to the directory and it isn't there. so I changed the upload_tmp_dir to C:\PHP\tmp and still I get nothing, and yet every time I do an upload, it says there is now a file available in $_FILES['file']['tmp_name']. also move_uploaded_file doesn't work (of course).
server 2003?
I found that when installing php5 on s2k3 i had some teething problems, I then tried the installer which totally failed.
I then follwed some new instructions, did not realise that I had two php.ini files one in C:/php and 1 oin C:/WINDOWS
have you checked you are using the correct .ini too?
just a thought.
I found that when installing php5 on s2k3 i had some teething problems, I then tried the installer which totally failed.
I then follwed some new instructions, did not realise that I had two php.ini files one in C:/php and 1 oin C:/WINDOWS
have you checked you are using the correct .ini too?
just a thought.
Are you uploading a picture? .jpg, or .gif?
If you are maybe you could try outputting it using image straight from the
Seems strange does this one 
If you are maybe you could try outputting it using image straight from the
Code: Select all
$_FILES['file']['tmp_name'];here is the output of a var_dump($_FILES);
see how it says that it's available now at "C:\uploaded_files\php1D.tmp" -- well it isn't there! 
Code: Select all
array(1) {
["data"]=>
array(5) {
["name"]=>
array(1) {
["Import"]=>
array(1) {
["import"]=>
string(33) "2007_Tax_Worksheet_JL_10-4-07.doc"
}
}
["type"]=>
array(1) {
["Import"]=>
array(1) {
["import"]=>
string(18) "application/msword"
}
}
["tmp_name"]=>
array(1) {
["Import"]=>
array(1) {
["import"]=>
string(27) "C:\uploaded_files\php1D.tmp"
}
}
["error"]=>
array(1) {
["Import"]=>
array(1) {
["import"]=>
int(0)
}
}
["size"]=>
array(1) {
["Import"]=>
array(1) {
["import"]=>
int(53760)
}
}
}
}Yes, that is strange.
Have you restared the server since configuration?
Not sure what going on with this one.
have you tried using error checking?
Have you restared the server since configuration?
Not sure what going on with this one.
have you tried using error checking?
Code: Select all
E_ALL- Kieran Huggins
- DevNet Master
- Posts: 3635
- Joined: Wed Dec 06, 2006 4:14 pm
- Location: Toronto, Canada
- Contact:
- Ollie Saunders
- DevNet Master
- Posts: 3179
- Joined: Tue May 24, 2005 6:01 pm
- Location: UK
Kieran is lazy. This is what I was referring to. You should check these configuration settings with ini_get() make sure they are what you're expecting. Otherwise I don't know what's going on.Kieran Huggins wrote:Ole suggests checking for "allow_file_uploads" in PHP.ini... appendix i.
Could you please try
Code: Select all
<html>
<body>
<form enctype="multipart/form-data" action="?" method="POST">
<div>
Send this file: <input name="data[Import][import]" type="file" />
<input type="submit" value="Send File" />
</div>
</form>
<?php
if ( isset($_FILES['data']['tmp_name']['Import']['import']) && 0==$_FILES['data']['error']['Import']['import'] ) {
check(dirname($_FILES['data']['tmp_name']['Import']['import']));
check($_FILES['data']['tmp_name']['Import']['import']);
}
else {
echo 'upload failure.';
echo '<pre>', var_dump($_FILES, true), "</pre>\n";
}
function check($path) {
if ( !file_exists($path) ) {
echo $path, " does not exist<br />\n";
}
else {
echo
is_dir($path) ? 'd':'-',
is_readable($path) ? 'r':'-',
is_writeable($path) ? 'w':'-',
is_executable($path) ? 'x':'-',
' ', $path;
if ( is_file($path) ) {
$fd = fopen($path, 'rb');
if ( !$fd ) {
echo '[ fopen failed ]';
}
else {
fseek($fd, 0, SEEK_END);
echo '[ ftell ', ftell($fd), ']';
fclose($fd);
}
}
echo "<br />\n";
}
}
?>
</body>
</html>
