Sabmin Posted December 18, 2010 Share Posted December 18, 2010 Trying to a. check if dir exists if not create it, and b. save an uploaded file to that directory. Nothing however is working but I'm pulling no errors, heres the code: $test_pic = $_POST['test_pic']; // I've also tried $test_pic = $_FILES["test_pic"]; : with no success if (is_uploaded_file($test_pic)) { if (!file_exists("tests/uploads/" . $test_name . "/")) { $create_test_folder = (mkdir("tests/uploads/" . $test_name)); if (!$create_test_folder) { echo "cant create folder"; die; } } $target_path = ("tests/uploads/" . $test_name . "/" . $test_name . "_1"); if (($_FILES["test_pic"]["type"] == "image/gif") || ($_FILES["test_pic"]["type"] == "image/jpeg") || ($_FILES["test_pic"]["type"] == "image/jpg") || ($_FILES["test_pic"]["type"] == "image/png") && ($_FILES["test_pic"]["size"] < 50000)) { if (!copy($test_pic, $target_path)) { echo "cant copy picture"; die; } } else { echo "file type or size bad"; die; } } and I understand its not at all public-safe but I'm just wanting to get it to work before I throw in the security. Thanks for the help! Quote Link to comment Share on other sites More sharing options...
BlueSkyIS Posted December 18, 2010 Share Posted December 18, 2010 try basic debug? if (is_uploaded_file($test_pic)) { // blah blah blah } else { echo "$test_pic is not an uploaded file!"; } Quote Link to comment 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.