jwk811 Posted April 4, 2010 Share Posted April 4, 2010 $pic = $_FILES['photo']; $ext = substr(strrchr($pic['name'], "."), 1); $imagePath = md5(rand() * time()) . ".$ext"; $target = "images/"; $target = $target . $imagePath; move_uploaded_file($pic['tmp_name'], $target); It works for me and I don't think it's the extension because it's always .jpg and it works for me. I just don't get what could be happening. It worked before perfectly until I changed things around but it's still the SAME! And the directory has just the same permissions as the last one when it worked. Quote Link to comment https://forums.phpfreaks.com/topic/197547-some-photos-wont-move-to-directory/ Share on other sites More sharing options...
TeddyKiller Posted April 4, 2010 Share Posted April 4, 2010 Are the photos not being moved, getting uploaded at all? Quote Link to comment https://forums.phpfreaks.com/topic/197547-some-photos-wont-move-to-directory/#findComment-1036770 Share on other sites More sharing options...
jwk811 Posted April 4, 2010 Author Share Posted April 4, 2010 i get the name of the photo stored in the database just fine. but there is no file uploaded. but it works half the time?? Quote Link to comment https://forums.phpfreaks.com/topic/197547-some-photos-wont-move-to-directory/#findComment-1036780 Share on other sites More sharing options...
jwk811 Posted April 4, 2010 Author Share Posted April 4, 2010 i think it has something to do with the extension being in capitals like .JPG but then i tried it myself and it worked but for everyone else capital extension seems to notupload. maybe thats not it at all i dont know Quote Link to comment https://forums.phpfreaks.com/topic/197547-some-photos-wont-move-to-directory/#findComment-1036781 Share on other sites More sharing options...
PFMaBiSmAd Posted April 4, 2010 Share Posted April 4, 2010 Your files are probably failing to upload and your code is not checking for any of the possible upload errors before accessing any of the uploaded data. Do you have any error checking logic in your code? Quote Link to comment https://forums.phpfreaks.com/topic/197547-some-photos-wont-move-to-directory/#findComment-1036783 Share on other sites More sharing options...
jwk811 Posted April 4, 2010 Author Share Posted April 4, 2010 no what should i put Quote Link to comment https://forums.phpfreaks.com/topic/197547-some-photos-wont-move-to-directory/#findComment-1036792 Share on other sites More sharing options...
PFMaBiSmAd Posted April 4, 2010 Share Posted April 4, 2010 http://www.phpfreaks.com/forums/index.php/topic,292945.msg1386624.html#msg1386624 The code at that link will check for and display upload errors. At the point where it has a the comment // put any type, size, file name/extension, or content validation here, you can put in any of the application level validation you need before you use move_uploaded_file() or put some of the uploaded file information into a database query statement. Quote Link to comment https://forums.phpfreaks.com/topic/197547-some-photos-wont-move-to-directory/#findComment-1036799 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.