RON_ron Posted January 26, 2012 Share Posted January 26, 2012 I'm using this to upload files to the server... sometimes files doesn't get uploaded. <?php if (is_uploaded_file($_FILES['Filedata']['tmp_name'])){ $uploadDirectory="uploads/"; $uploadFile=$uploadDirectory.basename($_FILES['Filedata']['name']); copy($_FILES['Filedata']['tmp_name'], $uploadFile); } ?> Quote Link to comment https://forums.phpfreaks.com/topic/255809-is_uploaded_file/ Share on other sites More sharing options...
phpSensei Posted January 26, 2012 Share Posted January 26, 2012 if your uploading files, and im assuming you mean through HTTP POST then use move_uploaded_file() Quote Link to comment https://forums.phpfreaks.com/topic/255809-is_uploaded_file/#findComment-1311340 Share on other sites More sharing options...
RON_ron Posted January 26, 2012 Author Share Posted January 26, 2012 ya... through HTTP POST. no luck though?? <?php if (move_uploaded_file($_FILES['Filedata']['tmp_name'])){ $uploadDirectory="uploads/"; $uploadFile=$uploadDirectory.basename($_FILES['Filedata']['name']); copy($_FILES['Filedata']['tmp_name'], $uploadFile); } ?> Quote Link to comment https://forums.phpfreaks.com/topic/255809-is_uploaded_file/#findComment-1311347 Share on other sites More sharing options...
phpSensei Posted January 26, 2012 Share Posted January 26, 2012 copy($_FILES['Filedata']['tmp_name'], $uploadFile); I ment that line of Code. Move_uploaded_file is a safer option as it requires the file to be a valid HTTP POST upload. Quote Link to comment https://forums.phpfreaks.com/topic/255809-is_uploaded_file/#findComment-1311351 Share on other sites More sharing options...
PFMaBiSmAd Posted January 26, 2012 Share Posted January 26, 2012 You have to check if the upload worked before you can attempt to access any of the uploaded file information. See these links - http://us2.php.net/manual/en/features.file-upload.errors.php http://us2.php.net/manual/en/ini.core.php#ini.post-max-size Quote Link to comment https://forums.phpfreaks.com/topic/255809-is_uploaded_file/#findComment-1311372 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.