dachshund Posted November 19, 2010 Share Posted November 19, 2010 I recently changed hosts, now my image uploader which used to work fine doesn't work. $indeximage = $_FILES['indeximage']; if($indeximage) { $indeximagename = basename($_FILES['indeximage']['name']); $indeximagenew = $_SERVER['DOCUMENT_ROOT'] . '/images/uploaded/index/' . $indeximagename; if (!file_exists($indeximagenew)) { if ((move_uploaded_file($_FILES['indeximage']['tmp_name'], $indeximagenew)) === true) { echo 'Index Image uploaded to this address '; echo 'http://www.address.co.uk/images/uploaded/index/'; echo $indeximagename; echo '<br />'; }else { echo 'Unable to move Index Image into the right folder.'; } } } It now echos Unable to move Index Image into the right folder. I tried putting: ini_set("display_errors", "1"); error_reporting(E_ALL); at the beginning. Before the upload it reads: Notice: Undefined index: images in /var/www/vhosts/huhmagazine.co.uk/httpdocs/admin/images.php on line 58 Notice: Undefined index: indeximage in /var/www/vhosts/huhmagazine.co.uk/httpdocs/admin/images.php on line 62 After it reads: Warning: move_uploaded_file(): Unable to move '/tmp/phpTd67fh' to '/var/www/vhosts/huhmagazine.co.uk/httpdocs/images/uploaded/index/calidewitt.jpg' in /var/www/vhosts/huhmagazine.co.uk/httpdocs/admin/images.php on line 71 Quote Link to comment https://forums.phpfreaks.com/topic/219178-broken-image-upload/ Share on other sites More sharing options...
JasonLewis Posted November 19, 2010 Share Posted November 19, 2010 The notice's are essentially telling you that you're upload form isn't working as you are expecting it to. The index you are requesting from the array does not exist. So either the file input field in your form isn't called indeximage or you don't have the multipart on the form tag. The warning will be a result from the notices, no doubt. Also ensure you have correct permissions. First step I would take is to print_r($_FILES); to see if anything is being posted correctly. Could be something to do with file size limits as well. Hard to tell. You just need to debug it at the moment. Quote Link to comment https://forums.phpfreaks.com/topic/219178-broken-image-upload/#findComment-1136561 Share on other sites More sharing options...
PFMaBiSmAd Posted November 19, 2010 Share Posted November 19, 2010 If you had continued this problem in the thread you already have for it, where you did post all the error messages you are getting, everyone would know the reason why it is failing and could help without needing to guess. Quote Link to comment https://forums.phpfreaks.com/topic/219178-broken-image-upload/#findComment-1136565 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.