Error404PageNotFound Posted October 6, 2012 Share Posted October 6, 2012 (edited) <p><p>HI I am having trouble using this function, I am hosting my website on 1and1 with the following php.ini: register_globals = 0 allow_url_fopen = 1 session.bug_compat_warn = 0 memory_limit = 128M max_execution_time=3600 post_max_size = 128M upload_max_filesize= 128M upload_tmp_dir = '/temp' And this is the code used to upload the file: <?php include ('connection.php'); session_start(); $target = "Images/"; $pic=$HTTP_POST_FILES['previewImage']['tmp_name']; $destination='/Images'; $date = date('d-m-Y'); $postarticle = "INSERT INTO articles VALUES (NULL,'$_POST[title]',CURDATE(), '{$_SESSION['ID']}','Images/$_POST[previewImage]', '$_POST[preview]', '$_POST[video]', '$_POST[content]', '$_POST[additionalInformation]', '$_POST[type]')"; if (mysql_query($postarticle,$conn)){ move_uploaded_file($pic,$destination.$HTTP_POST_FILES['previewImage']['name']); header("Location: index.php"); } else { header("Location: {$_SERVER['HTTP_REFERER']}"); } ?> Edited October 6, 2012 by Error404PageNotFound Quote Link to comment https://forums.phpfreaks.com/topic/269179-help-with-move_uploaded_file/ Share on other sites More sharing options...
requinix Posted October 6, 2012 Share Posted October 6, 2012 And your question is what? Quote Link to comment https://forums.phpfreaks.com/topic/269179-help-with-move_uploaded_file/#findComment-1383370 Share on other sites More sharing options...
Pikachu2000 Posted October 6, 2012 Share Posted October 6, 2012 Awesome. Did you have a question? Quote Link to comment https://forums.phpfreaks.com/topic/269179-help-with-move_uploaded_file/#findComment-1383372 Share on other sites More sharing options...
ManiacDan Posted October 7, 2012 Share Posted October 7, 2012 In case your question has something to do with the path of the destination: /images images/ Those are not the same thing. You have both in your code. /images is the root of the filesystem, you don't have permission to that. Quote Link to comment https://forums.phpfreaks.com/topic/269179-help-with-move_uploaded_file/#findComment-1383416 Share on other sites More sharing options...
PFMaBiSmAd Posted October 7, 2012 Share Posted October 7, 2012 In case your question had to do with $HTTP_POST_FILES not working or producing a bunch of errors, you should be using $_FILES Quote Link to comment https://forums.phpfreaks.com/topic/269179-help-with-move_uploaded_file/#findComment-1383491 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.