ali_kiyani Posted March 12, 2007 Share Posted March 12, 2007 Hello I developed a site for one of my client. The site was working fine on one host but when he moved to another host, file upload feature stopped working. I am using simple file upload code as below: if(isset($_FILES['image'])) { $target_path = "../images/products/"; $target_path = $target_path . basename($_FILES['image']['name']); $upload_result = move_uploaded_file($_FILES['image']['tmp_name'], $target_path); } I have double checked that the directory I am uploading to is writeable. When I contacted the host they say that I need to set following TMP dir for uploads to work /home/www/mysite.com/tmp/ How do I make changes to my code!? I mean how can I set this dir in my code!? Or do I need to do something else?! Thanks Quote Link to comment https://forums.phpfreaks.com/topic/42322-solved-file-upload-problem/ Share on other sites More sharing options...
vbnullchar Posted March 12, 2007 Share Posted March 12, 2007 uhm try INI_SET ( string varname, string newvalue ); Quote Link to comment https://forums.phpfreaks.com/topic/42322-solved-file-upload-problem/#findComment-205336 Share on other sites More sharing options...
skali Posted March 12, 2007 Share Posted March 12, 2007 Did you properly set permissions on the directory where you are trying to upload files. It won't upload anything if you don't have write permissions on the directory. Quote Link to comment https://forums.phpfreaks.com/topic/42322-solved-file-upload-problem/#findComment-205341 Share on other sites More sharing options...
ali_kiyani Posted March 12, 2007 Author Share Posted March 12, 2007 Problem is solved. I didn't change anything in my code and it is working. May be host made some changes. But strange thing is....the code I am using above is for product images....and dir permissions are set to 755 and it is uploading!! But the same code is not working for category images (another directory).....I had to set dir permissions to 757 to make it work. Quote Link to comment https://forums.phpfreaks.com/topic/42322-solved-file-upload-problem/#findComment-205366 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.