PHP upload failing
Moderator: General Moderators
feyd | Please use
The output is
Notice: Use of undefined constant name - assumed 'name' in D:\Inetpub\wwwroot\html\admin\pshomes\edit-communities.php on line 145
Debug: move_uploaded_file(d, /Inetpub/wwwroot/homes/html/images/temp/avatar60.jpg
Notice: Use of undefined constant name - assumed 'name' in D:\Inetpub\wwwroot\html\admin\pshomes\edit-communities.php on line 147
!is_uploaded_file()
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
So if i change it like soCode: Select all
if(array_key_exists('uploadNewLogo', $_POST)) {
if ($ID != "" && $ID != "new") {
error_reporting(E_ALL);
ini_set('display_errors', true);
echo "Debug: move_uploaded_file({$_FILES['newLogo']['tmp_name'][name]}, {$uploadfile2} <br />\n";
is_uploaded_file($_FILES['newLogo']['tmp_name'][name]) or die('!is_uploaded_file()');
is_readable($_FILES['newLogo']['tmp_name'][name]) or die('!is_readable(tmp_name)');
is_dir(dirname($uploadfile2)) or die('!is_dir('.dirname($uploadfile2).')');
is_writable(dirname($uploadfile2)) or die('!is_writable('.dirname($uploadfile2).')');
if(move_uploaded_file($_FILES['newLogo']['tmp_name'][name], $uploadfile2)) {
echo "The file ". basename($_FILES['newLogo']['tmp_name'][name]). "has been uploaded";
}else{
echo "There was an error uploading the file, please try again!";
}
createImage($uploadfile2,100,400,'/inetpub/wwwroot/homes/html/images/browse/logos/' . $ID . '.jpg');
createImage($uploadfile2,100,160,'/inetpub/wwwroot/homes/html/images/browse/logos/' . $ID . '-TH.jpg');
unlink($uploadfile2);
}
}Notice: Use of undefined constant name - assumed 'name' in D:\Inetpub\wwwroot\html\admin\pshomes\edit-communities.php on line 145
Debug: move_uploaded_file(d, /Inetpub/wwwroot/homes/html/images/temp/avatar60.jpg
Notice: Use of undefined constant name - assumed 'name' in D:\Inetpub\wwwroot\html\admin\pshomes\edit-communities.php on line 147
!is_uploaded_file()
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]ehh.... in case you're doing this on purpose: ha ha, not funny.
In case you're serious: $_FILES['newLogo']['tmp_name'][name] wrong, bad $_FILES['newLogo']['tmp_name'][name], no $_FILES['newLogo']['tmp_name'][name]
Start again with the script at viewtopic.php?p=398686#398686
and replace the only occurence of $_FILES['newLogo']['tmp_name'][name] by either $_FILES['newLogo']['tmp_name'] or $_FILES['newLogo']['name']
In case you're serious: $_FILES['newLogo']['tmp_name'][name] wrong, bad $_FILES['newLogo']['tmp_name'][name], no $_FILES['newLogo']['tmp_name'][name]
Start again with the script at viewtopic.php?p=398686#398686
and replace the only occurence of $_FILES['newLogo']['tmp_name'][name] by either $_FILES['newLogo']['tmp_name'] or $_FILES['newLogo']['name']
- superdezign
- DevNet Master
- Posts: 4135
- Joined: Sat Jan 20, 2007 11:06 pm
Please go back to viewtopic.php?p=398686#398686 and take the script posted there.
Then find the only line that contains $_FILES['newLogo']['tmp_name'][name] there.
Then post that line here.
Then find the only line that contains $_FILES['newLogo']['tmp_name'][name] there.
Then post that line here.
feyd | Please use
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
I changed that one line to ['tmp_name'] and thats it
Debug: move_uploaded_file(d:\Inetpub\wwwroot\temp\php170.tmp, /Inetpub/wwwroot/homes/html/images/temp/avatar60.jpg
The file avatar60.jpghas been uploadedCode: Select all
if(array_key_exists('uploadNewLogo', $_POST)) {
if ($ID != "" && $ID != "new") {
error_reporting(E_ALL);
ini_set('display_errors', true);
echo "Debug: move_uploaded_file({$_FILES['newLogo']['tmp_name']}, {$uploadfile2} <br />\n";
is_uploaded_file($_FILES['newLogo']['tmp_name']) or die('!is_uploaded_file()');
is_readable($_FILES['newLogo']['tmp_name']) or die('!is_readable(tmp_name)');
is_dir(dirname($uploadfile2)) or die('!is_dir('.dirname($uploadfile2).')');
is_writable(dirname($uploadfile2)) or die('!is_writable('.dirname($uploadfile2).')');
if(move_uploaded_file($_FILES['newLogo']['tmp_name'], $uploadfile2)) {
echo "The file ". basename($_FILES['newLogo']['name']). "has been uploaded";
}else{
echo "There was an error uploading the file, please try again!";
}
createImage($uploadfile2,100,400,'/homes/html/images/browse/logos/' . $ID . '.jpg');
createImage($uploadfile2,100,160,'/homes/html/images/browse/logos/' . $ID . '-TH.jpg');
unlink($uploadfile2);
}
}feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]hm, then move_uploaded_file() must be lying to you
..I doubt that
please try
..I doubt that
please try
Code: Select all
if(move_uploaded_file($_FILES['newLogo']['tmp_name'], $uploadfile2)) {
echo "<div>The file ". basename($_FILES['newLogo']['name']). "has been uploaded.</div>";
echo '<div>Location: ', realpath($uploadfile2), '</div>';
echo is_readable($uploadfile2) ? 'r':'-',
is_writable($uploadfile2) ? 'w':'-',
is_executable($uploadfile2) ? 'w':'-', "</div>\n";
echo '<div>filesize: ', filesize($uploadfile2), "</div>\n";
$fp = fopen($uploadfile2, 'rb');
echo '<div>first 50 bytes: ', fread($fp, 50), "</div>\n";
}
else{
echo "There was an error uploading the file, please try again!";
}Debug: move_uploaded_file(d:\Inetpub\wwwroot\temp\php185.tmp, /Inetpub/wwwroot/homes/html/images/temp/avatar60.jpg
The file avatar60.jpghas been uploaded.
Location: D:\Inetpub\wwwroot\homes\html\images\temp\avatar60.jpg
rw-
filesize: 4838
first 50 bytes: ÿØÿà�JFIF��–�–��ÿþ�LEAD Technologies Inc. V1.
Warning: unlink(/Inetpub/wwwroot/homes/html/images/temp/avatar60.jpg) [function.unlink]: Permission denied in D:\Inetpub\wwwroot\html\admin\pshomes\edit-communities.php on line 166
The file avatar60.jpghas been uploaded.
Location: D:\Inetpub\wwwroot\homes\html\images\temp\avatar60.jpg
rw-
filesize: 4838
first 50 bytes: ÿØÿà�JFIF��–�–��ÿþ�LEAD Technologies Inc. V1.
Warning: unlink(/Inetpub/wwwroot/homes/html/images/temp/avatar60.jpg) [function.unlink]: Permission denied in D:\Inetpub\wwwroot\html\admin\pshomes\edit-communities.php on line 166