i use this code to upload image and store it but it gives me an error and also the image not appear on the page but the title is appear please help me on this
Hi. First you can try to set 755 permissions for the folder where you store files. If that doesn't work then you can try to set 777 permissions. Suggestion: 1. Create separate folder for file uploads. 2. CHMOD that folder to 755 (or 777 if 755 doesn't work for you) 3. Use move_uploaded_file function like this: move_uploaded_file($_FILES['imagefile']['tmp_name'],"uploadsfolder/latest.img");
i use this code <?php // Thanks to "imoldgreg at o2 dot co dot uk" for the base 'CHMOD via FTP' script. function chmod_open() { // Use your own FTP info $ftp_user_name = 'xxxx'; $ftp_user_pass = 'xxxxx'; $ftp_root = '/'; $ftp_server = 'localhost'; $conn_id = ftp_connect($ftp_server); $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass); return $conn_id; } function chmod_file($conn_id, $permissions, $path) { if (ftp_site($conn_id, 'CHMOD ' . $permissions . ' ' . $ftp_root . $path) !== false) { return TRUE; } else { return FALSE; } } function chmod_close($conn_id) { ftp_close($conn_id); } // CHMOD the required setup files // Connect to the FTP $conn_id = chmod_open(); // CHMOD each file and echo the results echo chmod_file($conn_id, 777, 'latest.txt') ? 'CHMODed successfully!' : 'Error'; // Close the connection chmod_close($conn_id); ?> but gives me this error Warning: ftp_site() [function.ftp-site]: Could not change perms on latest.txt: No such file or directory in Untitled-1.php on line 19 Error
mirosoft1, In cPanel you should be able to go to "File Manager", select the folder, click "Change Permissions" link in the right frame and set the needed permissions.